function largestOfFour(arr) {
let newArr = [];
for(let i = 0; i < arr.length; i++){
let max = 0;
for (let j = 0; j < arr[i].length; j++){
if (arr[i][j] > max){
max = arr[i][j]
}
}
newArr.push(max)
}
return newArr
}
console.log(largestOfFour([
[4, 5, 1, 3],
[13, 27, 18, 26],
[32, 35, 37, 39],
[1000, 1001, 857, 1]]));
// [ 5, 27, 39, 1001 ]
I solved this Freecodecamp challenge, pushing the largest(row) number in each array into the newArr.
How can i make the code be printed in a column and get this output [1000, 1001, 857, 39]?