Three ways you can find the largest number in an array using JavaScript
Sonya Moisset
33225

One more using for loop:


function largestOfFour(arr) {
var arrr = [];

for(var i=0; i<arr.length; i++){
var wx = Math.max.apply(null,arr[i]);
arrr.push(wx);
}
return arrr;

}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

Show your support

Clapping shows how much you appreciated Vijay Anand Krishnan’s story.