Skip to content

Instantly share code, notes, and snippets.

@antic183
Last active May 19, 2016 10:58
Show Gist options
  • Save antic183/5df12e622ea3b92dd508 to your computer and use it in GitHub Desktop.
Save antic183/5df12e622ea3b92dd508 to your computer and use it in GitHub Desktop.
is number even or odd
function isEven(number) {
return !(number & 1);
}
function isOdd(number) {
return !!(number & 1);
}
isOdd(5); // true
isOdd(6); // false
isEven(4); // true
isEven(5); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment