Tell us what’s happening:
Why isn’t my program working?
Your code so far
function findElement(arr, func) {
let funcArr = arr.filter(func);
let result = funcArr.slice(0, 1).join('');
if (funcArr == '') {
result = undefined;
}
return result;
}
findElement([1, 2, 3, 4], num => num % 2 === 0);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/finders-keepers/