num-odd-or-even
v1.0.4
Published
find the given nuber odd or even
Downloads
26
Readme
🚀 odd-or-even
A fast, lightweight, and dependency-free utility to check if a number is odd or even without using the %
(modulo) operator. Perfect for JavaScript projects of all sizes!
🔧 Installation
You can install this package using npm
:
npm install num-odd-or-even
Usage
First, require the package in your JavaScript file:
const isOddOrEven = require('num-odd-or-even');
console.log(isOddOrEven(4)); // Output: true (even)
console.log(isOddOrEven(7)); // Output: false (odd)
console.log(isOddOrEven(-4)); // Output: true (even)
console.log(isOddOrEven(-7)); // Output: false (odd)
console.log(isOddOrEven(2.5)); // Throws Error: Value must be a valid integer
console.log(isOddOrEven(NaN)); // Throws Error: Value must be a valid integer
console.log(isOddOrEven('test')); // Throws Error: Value must be a valid integer
## Keywords
`JavaScript`, `Utility`, `Odd or Even`, `Number Checking`, `Fast`, `Lightweight`, `Dependency-Free`, `Error Handling`, `Integer Validation`, `npm Package`, `Mathematical Operations`, `Type Checking`, `Open Source`, `Software Development`, `Node.js`