Skip to content

Instantly share code, notes, and snippets.

@Sanchithasharma
Created January 3, 2022 07:18
Show Gist options
  • Save Sanchithasharma/3a74805bcae7012bee5708f323a6e2c8 to your computer and use it in GitHub Desktop.
Save Sanchithasharma/3a74805bcae7012bee5708f323a6e2c8 to your computer and use it in GitHub Desktop.
Return Largest Numbers in Arrays
function largestOfFour(arr) {
let largestArr = []
for (let el of arr) {
largestArr.push(Math.max(...el))
}
return largestArr;
}
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