During the software engineering immersive at General Assembly, we were tasked with completing some coding challenges to supplement our learning. The following coding challenges are described and completed in the linked folder.
- Write a function called sumNumbers that accepts a single array of numbers and returns the sum of the numbers in the array.
- If the array is empty, return 0 (zero).
- sumNumbers
- Write a function called addList that accepts any quantity of numbers as arguments, adds them together and returns the resulting sum.
- Assume all parameters will be numbers.
- If called with no arguments, return 0 (zero).
- addList
- Write a recursive function that returns the max value in an array.
- findMax
- Write a recursive function that returns the factorial of a given number.
- factorial
- Write a function that returns the Nth number in the fibonacci sequence.
- https://en.wikipedia.org/wiki/Fibonacci_number
- For this function, the first two fibonacci numbers are 1 and 1.
- fibonacci
- Write a function named computeRemainder that accepts two numeric arguments and returns the remainder of the division of those two numbers.
- The first argument should be the dividend and the second argument should be the divisor.
- If a 0 is passed in as the second argument you should return JavaScript's special numeric value: Infinity.
- For extra fun, complete this challenge without using the modulus (%) operator.
- computeRemainder
- Write a function called range that accepts two integers as arguments and returns an array of integers starting with the first argument up to one less than the second argument.
- The range function must be called with the first argument less than or equal to the second argument, otherwise return the string "First argument must be less than second".
- range
- Write a function called reverseUpcaseString that accepts a single string argument, then returns the string with its characters in reverse order and converts all characters to uppercase.
- reverseUpcaseString
- Write a function named charCount that accepts a single string argument and returns an object that represents the count of each character in the string.
- The returned object should have keys that represent the character with its value set to the how many times the character appears in the string argument.
- Upper and lower case characters should be counted separately.
- Space characters should be counted too.
- charCount