Skip to content

Instantly share code, notes, and snippets.

@light-traveller
Last active August 16, 2018 12:08
Show Gist options
  • Save light-traveller/9481ee5d769eeee4830d45b71e63166f to your computer and use it in GitHub Desktop.
Save light-traveller/9481ee5d769eeee4830d45b71e63166f to your computer and use it in GitHub Desktop.
[JavaScript Array Max/Min] element #js #javascript #array #array_min #array_max
/*
https://stackoverflow.com/a/31643591/1211622
*/
function arrayMax(array) {
return array.reduce((a, b) => Math.max(a, b));
}
function arrayMin(array) {
return array.reduce((a, b) => Math.min(a, b));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment