Https://www.freecodecamp.com/challenges/return-largest-numbers-in-arrays

https://www.freecodecamp.com/challenges/return-largest-numbers-in-arrays

why it’s not taking my answer ? In javascript editor it shows exact output as it is. here is my code:

function largestOfFour(arr) {
var largest = ;
for(var i = 0; i<arr.length; i++){
var newArr = arr[i].sort(function(a,b) {return b - a;});
//console.log(newArr);
//console.log(newArr[0]);
largest.push(newArr[0]);

//console.log(arr[i]);

}
console.log(largest);
}

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

//////////////////////////////////////
Here is the screen shot:

Your function isn’t returning anything. You are missing a return statement.

1 Like

your function is not returning…check the code and try inserting the return function

1 Like

exactly. now it works. Thanks man :blush: