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

Great articles, Sonya. Thank you for explanations. Here is how I did it:

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

I know it’s written in a mess, but it finishes the job :)

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.