NPM Smell 🍑💨

trivial and outdated NPM packages

is-odd trivial npm logo

Checks if a number is odd.

Weekly Downloads
286,326
Dependencies
1
Latest Release
6 years ago
The provided functionality does not warrant its own package
Trivial

Dependency Tree

is-odd
  is-number

About

This dependency checks if a number is odd.

This can be done natively with the % remainder operator. It returns the remainder leftover.

1 % 2; // 1
2 % 2; // 0
3 % 2; // 1
4 % 2; // 0
// ...

Odd numbers return 1, so a corresponding function would look like:

function isEven(number) {
    return number % 2 !== 0;
}

isEven(3); // true
isEven(6); // false