0
code not giving result
why doesn't the following code gives result:- const printOdds = (arr) =>{ arr.forEach(el=> { if (el % 2 != 0) console.log(el); }); }
2 Answers
0
Hello, try
const printOdds = (arr) =>{
arr.forEach(el=> {
!(el % 2) &&
console.log(el);
});
}
printOdds([1,2,3,4,5,6]);
0
Code works (output to console) as I tested it.