Returning element in an array that passes a test [solved, typo]

Hi there, first time here at this forum, so sorry if my format is incorrect.

I am currently trying to solve this problem: Create a function that looks through an array (first argument) and returns the first element in the array that passes a truth test (second argument). If no element passes the test, return undefined.

Why is my code not working but when I declare a new variable for arr[i] and pass this to the func argument it is working?

function findElement(arr, func) {
  for(let i = 0; i < arr.lenght; i++){
    
    if(func(arr[i]))
    {
      return arr[i];    
      }
  }
  return undefined;
}

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

Thanks in advance!

You have a typo in this line:

  for(let i = 0; i < arr.lenght; i++){

Thanks, that was it indeed. Stupid me haha.