Return Largest Numbers in Arrays - Got answers but not counting as correct

Return Largest Numbers in Arrays - Got answers but not counting as correct
0

Hey all, for some reason when I run the below code as an answer to this challenge I do get the answers that the instructions say I should get.
However, when I run the test I’m failing on the 2nd through final challenges.

What could I be doing wrong here?
My only guess is I ended up doing the Functional Programming section out of order, so I applied the .map method here instead of using a normal for loop.

``````
function largestOfFour(arr) {
let temp_arr = [];
temp_arr.push(arr.map(x => x.sort(function(a, b){return b-a})[0]));
return temp_arr;
};

console.log(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]));
console.log(largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]));
console.log(largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]));
console.log(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]));
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36`.
You’re returning a nested array like this: `[[27, 5, 39, 1001]]`. You need to return just a single array like this. `[27, 5, 39, 1001]`
The reason for nested array is, `arr.map` returns an array, and you push that array into another `temp_arr` array.
Hint: Your `temp_arr` can be removed and your solution will become a one-liner!