DML School of Technology
Menu

First steps, Numbers

Odd or even

The task

Return true if the number is even and false if it is odd. Zero is even; negative numbers can be either.

Hint: the remainder operator %.

Write a function called isEven.

Tests

CallExpectedYours
isEven(4) true not run
isEven(7) false not run
isEven(0) true not run
isEven(-3) false not run
isEven(-10) true not run

Next challenge · All challenges

solution.js

Tab indents. To leave the editor, press Escape, then Tab.

Output

Run prints what your code prints. Run the tests to check your function.