Finders Keepers help

Tell us what’s happening:

Your code so far

function findElement(arr, func) {
  let num = arr.func;
  return num;

findElement([1, 2, 3, 4], num => num % 2 === 0);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

So, you have this code here:

let num = arr.func;

What that code is saying is that the array has a method called func that you can call. Does your array have a method func? No, it doesn’t. The function is separate and not a method of the array.

I am sure there are different ways to solve this, but one way is to use a for loop on the array and return the first value in the array where if you call the function on that index it returns true. So maybe something in your for loop like this:

if(func(arr[i]) === true){
      return arr[i];