What mistake here? In the usual if everything worked, but here the first condition is not accepted.
function findElement(arr, func) {
let num = 0;
for (let i = 0; i < arr.length; i++) {
num = arr[i];
return func(num) ? num : undefined
}
}
findElement([1, 2, 3, 4], num => num % 2 === 0);