function largestOfFour(arr) { var newArray = []; for(var i =0; i <=arr.length-1; i++){ console.log(arr[i]); newArray[i] = Math.max(arr[i]);
It won't work like that. Math.max expect separate numbers. You can get desired output using apply
Math.max
apply
function largestOfFour(arr) { return arr.map(function(subArr){ return Math.max.apply(Math, subArr); }); }