Skip to content

Instantly share code, notes, and snippets.

@felixzapata
Created December 19, 2012 18:53
Show Gist options
  • Save felixzapata/4339343 to your computer and use it in GitHub Desktop.
Save felixzapata/4339343 to your computer and use it in GitHub Desktop.
How to determine if a number is odd in JavaScript
// http://stackoverflow.com/questions/5016313/how-to-determine-if-a-number-is-odd-in-javascript
function oddOrEven(x) {
return ( x & 1 ) ? "odd" : "even";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment