Return largest numbers in arrays Question

Return largest numbers in arrays Question
0

#1

I have solved this before with the same code, as far as I remember… but now I’m getting “SyntaxError Unexpected token [”. Is there something I’m overlooking? Or perhaps a bug?

function largestOfFour(arr) {
  var largest=[0,0,0,0];
  for(var i=0;i<arr.length;i++){
    for(var j=0;j<arr[i].length;j++){
      if(arr[i][j].length>largest[i]){
        largest[i]=arr.[i][j].length;
      }
    }
  }
  return largest;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

#2

Here:

largest[i]=arr.[i][j].length;

#3

Ok… the source of my error was adding .length in my if statement.