Tell us what’s happening:
This passes all the tests provided yet doesn’t clear the challenge. Am I doing something wrong? I have very limited knowledge of the .splice() method, discovered it while looking for an answer to this. Maybe that’s what’s wrong, but again, the code passes all the tests.
Your code so far
function largestOfFour(arr) {
for(var i = 0; i < arr.length; i++) {
arr[i].sort(function(a, b){return b-a;});
arr[i].splice(-3, 3);
}
return arr;
}
largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393
.
Link to the challenge: