Skip to content

Instantly share code, notes, and snippets.

@gulzaar
Created November 30, 2015 17:29
Show Gist options
  • Save gulzaar/01e8885c14d26f39a253 to your computer and use it in GitHub Desktop.
Save gulzaar/01e8885c14d26f39a253 to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/gulzaar 's solution for Bonfire: Return Largest Numbers in Arrays
// Bonfire: Return Largest Numbers in Arrays
// Author: @gulzaar
// 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) {
// You can do this!
var mNum = new Array();
for (var row = 0; row <= arr.length-1; row++) {
mNum[row] = Math.max.apply(0, arr[row]);
}
return mNum;
}
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