Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JeffreyBodin/f1c2dc8777b354a82a6411432d2be7bb to your computer and use it in GitHub Desktop.
Save JeffreyBodin/f1c2dc8777b354a82a6411432d2be7bb to your computer and use it in GitHub Desktop.
// 2020-09-28
// Javascript - Reference
// img archive: https://i.imgur.com/hOLhbmw.png
// License:
// https://creativecommons.org/licenses/by-sa/4.0/
// https://stackoverflow.com/a/30060894
Use:
var arr = [1, 2, 3, 4];
var largest = arr.reduce(function(x,y) {
return (x > y) ? x : y;
});
console.log(largest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment