Results are correct, but can't pass

Tell us what’s happening:
So far I test my code and results are exactly same as required. But still can’t pass.
Anyone can help me to figure out the reason?

Your code so far

var res = [];
function largestOfFour(arr) {
  for(var i = 0; i < arr.length; i++ ){
     res.push(Math.max.apply(null, arr[i]));
  return res;
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_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36```.

**Link to the challenge:**

Your code has an error on the 3rd line, because res is not defined anywhere. If you define res as an empty array inside your function, you will pass the tests. Make sure you are not declaring res globally, because the FCC tests run consecutively and if res was global it’s value would not be reset to a blank array after each test.

1 Like

Thanks for the quick answer. I actually declare it in the beginning but still can’t pass.

Read my last reply again. I told you what NOT to do in order for your code to pass.