Skip to content

Instantly share code, notes, and snippets.

  • Save anonymous/aed91349b306c1dc8c5b to your computer and use it in GitHub Desktop.
Save anonymous/aed91349b306c1dc8c5b to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/rfkdali 's solution for Bonfire: Return Largest Numbers in Arrays
// Bonfire: Return Largest Numbers in Arrays
// Author: @rfkdali
// Challenge: http://www.freecodecamp.com/challenges/bonfire-return-largest-numbers-in-arrays?solution=function%20largestOfFour(arr)%20%7B%0A%20%20return%20arr.map(function(tab)%7B%0A%20%20%20%20return%20Math.max(...tab)%3B%0A%20%20%7D)%3B%0A%7D%0A%0AlargestOfFour(%5B%5B4%2C%205%2C%201%2C%203%5D%2C%20%5B13%2C%2027%2C%2018%2C%2026%5D%2C%20%5B32%2C%2035%2C%2037%2C%2039%5D%2C%20%5B1000%2C%201001%2C%20857%2C%201%5D%5D)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function largestOfFour(arr) {
return arr.map(function(tab){
return Math.max(...tab);
});
}
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