Jeśli dziwne JS
function isEven(value) {
return !(value % 2)
}
Hafez
function isEven(value) {
return !(value % 2)
}
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")
}
let arr = [1,2,3,4,5,6,7,8,9,10,11,12]
let odds = arr.filter(n => n%2)
console.log(odds)
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 isOdd = n => !!(n & 1)