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

i used a for loop to sort each subarray from largest to smallest, then pushed the first index to an empty array. Seems to work.

function largestOfFour(arr) {
 var numbers = [];
 for (var i = 0; i < arr.length; i++) {
 arr[i].sort(function(a, b) {
 return b — a;
 return numbers;

Like what you read? Give Anthony Blackman a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.