- Create a program that will add two numbers and return the answer
add(1,2) // should return 3
- Create a program that will add or subtract two numbers and return the answer
calculator(1, 2, "add") // should return 3
calculator(1, 2, "subtract") // should return -1
- Create a program that will get the sum of the numbers between 1 and n and return the answer
summation(5) // should return 15 because 1+2+3+4+5=15
- Create a program to get the average of a group of numbers
avg([8, 2, 2, 4]) // should return 4
- Create a program to get the sum of all the even numbers in a group
summationEven(5) // should return 6 because 2+4=6
- Create a program to reverse the letters in a word
reverse("caterpillar") // should return "rallipretac"
- Create a function that takes an array of words and combines them with a dash
addDashes(['test1', 'test2', 'test3']) // should return "test1-test2-test3"
- Function that will count up to a number and back down and return a string of the climb
countUpAndDown(3) // should return "1 2 3 2 1"
- Write a function that will tell you all of the words in an array that contain the letter a
wordsWithA(['cat', 'rabbit', 'dog', 'frog']) // should return ['cat', 'rabbit']
- Function that returns the longest word in sentence
longestWord("The cat in the house") // should return "house"
Last active
January 17, 2020 19:59
-
-
Save MicFin/891e003ec08aa59aeb77a4a69da2e5b1 to your computer and use it in GitHub Desktop.
JS Functions Challenges
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment