Return Largest Numbers in Arrays - Why not passing? [SOLVED]

Tell us what’s happening:

It looks like my code should be passing? It successfully returns the expected result for each of the test cases, but it will not let me pass. Any help would be much appreciated.

Your code so far

function largestOfFour(arr) {
  // You can do this!
  for(i=0; i < arr.length; i++){
    var subArray = arr[i];
    var largestNumber = 0;
    for(y=0; y < subArray.length; y++){

      if(subArray[y]>largestNumber){
        largestNumber = subArray[y];
      }

    }

    largestNumArray.push(largestNumber);

  }
  return largestNumArray;
}

largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/return-largest-numbers-in-arrays

Your code refers to a largestNumArray variable but it’s not declared anywhere in your code.

Ah, I had it declared globally outside the function so I guess FCC doesn’t pick it up there? I stuck it inside the function and then it worked. Thanks!