Files
30-seconds-of-code/javascript/snippets/is-even.md
2023-05-01 22:35:56 +03:00

383 B

title, type, tags, cover, dateModified
title type tags cover dateModified
Number is even snippet
math
by-the-lighthouse 2020-10-20T23:02:01+03:00

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