-
-
Save tecnocrata/e5f5fe86144e9a4ecf45567ce9396c98 to your computer and use it in GitHub Desktop.
FInd the max number with es6 with an array.
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
| let numbers = [4,6,3,8]; | |
| let max = Math.max(...numbers); | |
| console.log(max); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Best applied solution is:
[1,2,3,4].reduce((max, n) => n > max ? n : max)