Why are the test runs failing for my function? I checked in Chrome’s developer console and it runs perfectly with the same results that the test show’s should be returning. Question is to write a function that returns the largest numbers in an array. I attached a screenshot with the failed tests.
Your code so far
function largestOfFour(arr) {
new_arr = [];
for(var i = 0; i < arr.length; i++){
var highestNum = Math.max.apply(null, arr[i]);
new_arr.push(highestNum);
};
return new_arr;
};
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
.
Link to the challenge: