Return Largest Numbers in Arrays, stuck please help

Tell us what’s happening:
I am stuck with Return Largest Numbers of Arrays quiz. Please help me what I should do. Thank you!

Your code so far

function largestOfFour(arr) {
  // You can do this!
  var result = [];
  
  for (var i = 0; i < arr.length; i++) {
    for (var l = 0; i < arr[i].length; i++) {
    //var array = arr[i][l];
      result.push(arr[i][l].reduce(function(a,b) {
        return Math.max(a, b);

      }));


    } 
  }


  return result;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

Your browser information:

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

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

To solve this, I create a second array and then used some logic to determine which numbers would go into that array. Here’s a prototype to see if you can figure it out:

var newArray = new Array[];

for each of the first-level arrays {
for each of the second-level arrays {
if the second number is greater than the first number in the second-level array, put it in the newArray

It’s a prototype. I’m trying to not give him real code.

That sounds much better. Thank you.

What is the best method for a second for loop?

@camperextraordinaire I try to use nested for loop then sort it with like .sort(function(a,b){ b - a });. Make sense?

I passed it by using comparison operators. It was a hard one. Thank you for your help.