Return Largest Numbers in array Works but wont pass

Hello everyone, Im a little stuck my code works, It returns the largest array every time no matter where the number with the largest array is so im not sure why its not passing. Any thoughts would be great.

function largestOfFour(arr) {
var count = 0;
var largestNumber = 0;
for(var i = 0; i < arr.length; i++){
for(var j = 0; j < arr[i].length; j++){
if(arr[i][j] > largestNumber){
largestNumber = arr[i][j];
count = arr[i];

       }
     }
   }

return count;
}

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

For me, your code returns:

[32, 35, 100000, 39]

but the answer should be:

[5, 27, 100000, 1001]

Looking at your code, I have no idea what count is supposed to do. Get rid of it. We need to examine each sub array of four numbers and replace that subarray with the largest number.

So we must examine arr[i], the first of which is [4, 5, 1, 3], see that 5 is largest and assign 5 to arr[i].

Your variable largestNumber needs to be declared inside your i loop (or at least set to 0). This needs to start at 0 for each i loop to check each subarray.

At the end of your j loop, you need to assign largestNumber into that array slot, namely arr[i], replacing the subarray we were checking with its largest member.

Then you must return arr.