Files
30-seconds-of-code/snippets/isOdd.md
Isabelle Viktoria Maciohsek 27c168ce55 Bake date into snippets
2021-06-13 13:55:00 +03:00

372 B

title, tags, firstSeen, lastUpdated
title tags firstSeen lastUpdated
isOdd math,beginner 2019-09-25T20:35:06+03:00 2020-10-20T23:02:01+03:00

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