Basic Algorithm Scripting: Return Largest Numbers in Arrays questionn

function largestOfFour(arr) {
  var arr2=[]
  for(i=0;i<arr.length;i++){
    var largest = arr[i][0]
    for(j=0;j<arr[i].length;j++){
      if (arr[i][j]>largest){
        largest=arr[i][j]
      }
    }
    arr2.push(largest)
  }
  return arr2
}

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

not sure where I’m wrong?

Make sure you declare all variables before they are used.