So I've been fighting with this a few hours now- the goal is to create a new array of the highest numbers in each array of 4. However, I can't seem to get it to loop more than once. How am I screwing up this for loop?
function largestOfFour(arr) { for (var i = 0; i < arr.length; i++) { var allTop = ""; var top = arr[i].sort(function(a, b) { return b - a; }); i++; allTop.push(top[0]); } } largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
allTop.push is not a function.