Created
August 26, 2022 14:38
-
-
Save snsxn/402b120457ae72647d55d9ba4d23f952 to your computer and use it in GitHub Desktop.
One-line get largest element of an Array - JavaScript ES2015, ES6
This file contains 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
const getLargestElement = (arr) => arr.reduce((largest, num) => Math.max(largest, num)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment