JavaScript Exercise Set 4
Sum of all numbers from 1 to N.
Create a function that adds all the numbers from 1 up to the user inputted numeric value
Parameter:
a number
Returns:
a number
FizzBuzz in a Range
“FizzBuzz.”
From start
to end
, if the number is a multiple of three: print “Fizz”
, if the number is a multiple of five: print “Buzz”
, if they are multiples of both: print “FizzBuzz”
.
2 Parameters:
num1
andnum2
; if num2 <= num1 output -1Returns:
Nothing, no return
Vowel Counter
Assume that our vowels in our alphabet are only from this set: a e i o u
.
Given a string parameter, return the number vowels within it.
There are two vowels in Hello
and one vowel in World!
.
Parameter:
a string
Returns:
a number
Prime Number Checker
Create a function that determines if the parameter of 2 or greater is a prime number.
Parameter:
a number
Returns:
a boolean
Palindrome Checker
A palindrome is a word that is the same spelt forwards and backwards.
Some examples of Palindromes:
civic
madam
level
mom
racecar
tacocat
Create a function that determines if the parameter is a palindrome.
Parameter:
a string
Returns:
a boolean
Last updated