Just need help in identifying what I am doing wrong on this codewar challenge.
I realize this may be easy for some but please note I am just a beginner with Javascript.
Another possible way:
function myFunction(integers) { var odds = integers.filter(function(num) {return num % 2}); var evens = integers.filter(function(num) {return !(num % 2)}); return evens.length == 1 ? evens[0] : odds[0]; }
You can check out this CodePen Demo to test the function in Mocha.