function largestOfFour(arr) {
var newArray = [];
for(var i =0; i <=arr.length-1; i++){
console.log(arr[i]);
newArray[i] = Math.max(arr[i]);
You are passing an array to Math.max
and expect it to return the maximum in that array.
However, Math.max
returns the maximum among its arguments. So use
var newArray = [];
for(var i =0; i < arr.length; ++i)
newArray[i] = Math.max.apply(void 0, arr[i]);
In ES6, you can use arrow functions and the spread operator to simplify:
arr.map(a => Math.max(...a));