Number is even

OSCC · JavaScript, Math · Oct 20, 2020

Checks if the given number is even.

  • Checks whether a number is odd or even using the modulo (%) operator.
  • Returns true if the number is even, false if the number is odd.
const isEven = num => num % 2 === 0;
isEven(3); // false

Would you like to help us improve 30 seconds of code?Take a quick survey

Recommended snippets