Answers for "find even odd number in javascript"

4

check if even or odd javascript

function evenOrOdd(num) { //for string length take string
  if (num % 2 == 0) {//and replace numm with string.length here
    return "even";
  } else {
    return "odd";
  }
}
Posted by: Guest on November-22-2020
3

odd or even js

for(let count =0; count<=100;count++){
 count%2==0? console.log(`${count} is even`):console.log(`${count} is odd`);
 ;
}
Posted by: Guest on June-28-2020
0

log odd numbers js

for(var n = 0; n <= 10; n+=2) console.log(n)
Posted by: Guest on March-02-2021
0

odd number is javascript

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
Posted by: Guest on October-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language