Created
September 6, 2019 18:42
-
-
Save masautt/c666b85dc77ba2b0d913162a5e55548a to your computer and use it in GitHub Desktop.
How to find the largest value of an array in JavaScript?
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
| function largestVal(arr) { | |
| return Math.max(...arr) | |
| } | |
| console.log(largestVal([1,9,5,4,11,3,3,4,2,])); // --> 11 | |
| // https://www.jstips.co/en/javascript/calculate-the-max-min-value-from-an-array/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment