JS até ou
function isEven(n) {
return n % 2 == 0;
}
function isOdd(n) {
return Math.abs(n % 2) == 1;
}
Hafez
function isEven(n) {
return n % 2 == 0;
}
function isOdd(n) {
return Math.abs(n % 2) == 1;
}
const number = 5; //The input number whatsoever, in this case '5'
//Using an if-else statement and the modulo operator
if (number % 2 === 0) {
console.log("even")
} else {
console.log("odd")
}
function isOdd(numbers) {
if (numbers % 2 != 0) {
return true;
}
return false;
}
var input = 343;
var result = isOdd(input);
console.log(result)
//Outpur: true
for(let count =0; count<=100;count++){
count%2==0? console.log(`${count} is even`):console.log(`${count} is odd`);
;
}
const isEven = (num) => num % 2 === 0;
console.log(isEven(5));// falseconsole.log(isEven(4));// true
const OddorEven = (num)=>num&1?"odd":"even";