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

296 B

title, tags
title tags
isOdd math,beginner

Checks if the given number is odd.

  • Check whether a number is odd or even using the modulo (%) operator.
  • Return true if the number is odd, false if the number is even.
const isOdd = num => num % 2 === 1;
isOdd(3); // true