JavaScript · Exercise 1 of 5Next
Beginner
Even or odd?
Finish the function evenOrOdd(n) so it returns the string "even" when the whole number n is even and "odd" when it is odd.
It must work for 0 and for negative numbers too, like -3 and -8.
What Check tests
- Even numbers give
"even" - Odd numbers give
"odd" 0is even- Negative numbers work:
-3is odd,-8is even
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.