Skip to content

Instantly share code, notes, and snippets.

Created December 6, 2015 01:34
Show Gist options
  • Save anonymous/8c540036040f8414ad0a to your computer and use it in GitHub Desktop.
Save anonymous/8c540036040f8414ad0a to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/fcc0208647c 's solution for Bonfire: Return Largest Numbers in Arrays
// Bonfire: Return Largest Numbers in Arrays
// Author: @fcc0208647c
// Challenge: http://www.freecodecamp.com/challenges/bonfire-return-largest-numbers-in-arrays#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function largestOfFour(arr) {
maxes = [];
for (i=0;i<arr.length;i++){
highest = Math.max.apply(Math, arr[i]);
maxes.push(highest);
}
return maxes;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment