Last active
August 16, 2018 12:08
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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