js even or
function isEven(n) {
return n % 2 == 0;
}
function isOdd(n) {
return Math.abs(n % 2) == 1;
}
js even or
function isEven(n) {
return n % 2 == 0;
}
function isOdd(n) {
return Math.abs(n % 2) == 1;
}
how to check if number is even
if ( n % 2 == 0 ) {
// n is even
}
else {
//otherwise odd
}
javascript check if a number is even or odd
const isEven = num => num % 2 === 0;
console.log(isEven(2));
// Result: True
Javascript Check if number is even or odd
function solution(num) {
return num % 2 === 0 ? 'Even' : 'Odd'
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us