Created
June 15, 2014 20:39
-
-
Save macikokoro/1a39f3c1d8ad01170153 to your computer and use it in GitHub Desktop.
Code to check for odd or even numbers
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
var isOdd = function (n) { | |
if (n % 2 === 0) { | |
return false; | |
} else { | |
return true; | |
} | |
}; | |
console.log(isOdd(1)); | |
console.log(isOdd(2)); | |
console.log(isOdd(999)); | |
var isEven = function (n) { | |
if (n % 2 === 0) { | |
return true; | |
}else { | |
return false; | |
} | |
}; | |
console.log(isEven(1)); | |
console.log(isEven(2)); | |
console.log(isEven(999)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment