1.3.0 • Published 2 years ago
odd-even-identifier v1.3.0
Demo
To use this package, import the program
const oddEven = require('odd-even-identifier')
// Alternatively you can import by a function
const {isEven, isOdd, oddOrEven} = require('odd-even-identifier)
Example usage to check if a number is even
oddEven.isEven(3) // false
oddEven.isEven(2) // true
oddEven.isEven(null) // Will throw an error
oddEven.isEven(false) // Will throw an error
Example usage to check if a number is odd
oddEven.isOdd(3) // true
oddEven.isOdd(2) // false
oddEven.isEven(null) // Will throw an error
oddEven.isEven(false) // Will throw an error
To verify whether if a number is odd or even
The result will return in string type odd or even
oddEven.oddOrEven(30) // even
oddEven.oddOrEven(11) // odd
oddEven.oddOrEven('hi') // Will throw an error