Created
December 19, 2012 18:53
-
-
Save felixzapata/4339343 to your computer and use it in GitHub Desktop.
How to determine if a number is odd in JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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