Answers for "how to return odd one out from an array in js"

CSS
0

javavscript use .filter to return odd numbers in an array

let arr = [1,2,3,4,5,6,7,8,9,10,11,12]

let odds = arr.filter(n => n%2)

console.log(odds)
Posted by: Guest on July-10-2020
1

print odd numbers in an array in javascript

[1,2,3,4].forEach((num) => num % 2 === 0 && console.log(num));
Posted by: Guest on July-11-2021

Code answers related to "how to return odd one out from an array in js"

Browse Popular Code Answers by Language