Write a function that returns the largest of two numbers. If they are equal, return the second one.
Example:
Input: 12, 4
Output: 12
Write a function named getDogAge that takes one argument: a dog's age in human years. The function returns the dog's age in dog years. The conversion rate is 1 human year to 7 dog years.
Example:
Input: 4
Output: 28
Write a function arraySum
that takes in an array and returns the sum of all the elements.
Example:
Input: [13,2,4,-2]
Output: 17
Write a function that takes in any two numbers and return their sum.
Example:
Input: 14, 5
Output: 19
Write a function takes in any number grade and returns a corresponding letter grade.
Number Grade | Equivalent Letter Grade |
---|---|
100 | A+ |
90 - 99 | A |
80 - 89 | B |
70 - 79 | C |
65 - 69 | D |
Below 65 | F |
Example:
Input: 88
Output: "B"
Implement a function named repeatLog
that takes a string and a number as parameters. The function should log message
count
number of times.
Example:
Input: "+", 10
Output: ++++++++++
Write a function named first
that takes a number and returns an array with all the numbers from 1 to n
Example:
Input: first(3)
Output: [1, 2, 3]
Write a function that logs the numbers from 1 to x, except:
If the number if a multiple of 3, log "Fizz"
instead of the number
If the number is a multiple of 5, log "Buzz"
instead of the number
If the number is a multiple of 3 AND 5, log "FizzBuzz"
instead of the number
Your function should take in one parameter: x (the number to count up to)
Write a function named reverse
that takes an array as a parameter. The function should return an array in reverse order.
Example:
Input: reverse([1, 2, 3])
Output: [3, 2, 1]
Write a function that prints out the most frequently occurring element in an array.
Example:
Input: [2,1,4,2,5,2,3,23,3,3,2,2,2,24,56,2,2,5,46,2]
Output: 2
Write a function that sums all the even numbers in an array.
Example:
Input: [1,2,5,64,23,22,91,3]
Output: 88
Write a function that flips an object. All of the keys are now values and all of the values are now keys.
Example:
Input: {1: "uno", 5: "cinco"}
Output: {"uno": 1, "cinco": 5}
Write a function that determines if a value is inside of array.
Example:
Input: [1,4,6,9,10], 5
Output: false