Files
30-seconds-of-code/snippets/isEven.md
Isabelle Viktoria Maciohsek caa67e2a49 Update snippet descriptions
2020-10-20 23:02:01 +03:00

303 B

title, tags
title tags
isEven math,beginner

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