how to check whether a number is even or odd in javascript using modulo operator code example
Example: how to check if number is even
if ( n % 2 == 0 ) {
// n is even
}
else {
//otherwise odd
}
if ( n % 2 == 0 ) {
// n is even
}
else {
//otherwise odd
}