JavaScript curriculum
JavaScript practice
Short exercises. Try them first, open the hint if you are stuck, and the solution last.
Exercise 1
Even or odd
Write isEven(n) that returns true when n is even. Then print isEven(4) and isEven(7).
Your solutionJavaScriptExercise 2
Sum to n
Write sumTo(n) that adds 1 + 2 + ... + n using a loop. sumTo(5) should be 15.
Your solutionJavaScriptExercise 3
FizzBuzz
Print numbers 1 to 15. For multiples of 3 print Fizz, multiples of 5 print Buzz, multiples of both print FizzBuzz.
Your solutionJavaScript