JavaScript prüfen, ob die Nummer gerade oder ungerade ist
function solution(num) {
return num % 2 === 0 ? 'Even' : 'Odd'
}
Cautious Cockroach
function solution(num) {
return num % 2 === 0 ? 'Even' : 'Odd'
}
function isEven(value) {
return !(value % 2)
}
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
let arr = [1,2,3,4,5,6,7,8,9,10,11,12]
let odds = arr.filter(n => n%2)
console.log(odds)
Run code snippetHide results