Can anyone point me to some code to determine if a number in JavaScript is even or odd?
Use the below code:
function isOdd(num) { return num % 2;} console.log("1 is " + isOdd(1)); console.log("2 is " + isOdd(2)); console.log("3 is " + isOdd(3)); console.log("4 is " + isOdd(4));
1.4m articles
1.4m replys
5 comments
56.9k users