You are doing it wrong, and got the challenge not correct.
Check the expected results, and challenge again.
I needs you find maximum value of each array , then put all these numbers together and return an array contains maximum number of each index.
largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]) should return [25, 48, 21, -3].
If you check the expected result
[25, 48, 21, -3], you see the first index(25) is the maximum number of first array, second(48) is the largest in second array and so on…
Hint: before you go to search for max value, have a result as array.
With two for loop(as you did) try to find the maximum number of each 2nd-level array(not the whole data).
TIP: always assume first element of each array as maximum.
No, this is possible to return arr just like the code you quoted, but OP got the challenge wrong.