Return Largest Numbers. Feel like this should work

Tell us what’s happening:
Hey everyone! So I’m not sure what’s really happening. When I console.log my code I’m getting the right solution but somehow I keep failing. My guess is that what I’m returning is not an array, however it tells me that what I’m returning is an array. Thanks for the help!

Your code so far


function largestOfFour(arr) {
  for (let i = 0; i < arr.length; i++){
    arr[i].sort(function(a, b) {return a - b});
    var newArr = [arr[i][3]];
    console.log(newArr)
  }
  // You can do this!
  return newArr;
}

largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]])

Your browser information:

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

Look at the format which it returns.

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

You are returning an array that has the largest value from each subarray.

Is this how you add an element/s to an array in javascript ?