determin if a number is even or odd js code example
Example 1: if odd js
function isEven(value) {
return !(value % 2)
}
Example 2: how to check if number is even
if ( n % 2 == 0 ) {
// n is even
}
else {
//otherwise odd
}
function isEven(value) {
return !(value % 2)
}
if ( n % 2 == 0 ) {
// n is even
}
else {
//otherwise odd
}