Created
September 6, 2019 18:43
-
-
Save masautt/e083d73429887f53fa384b726d82deea to your computer and use it in GitHub Desktop.
How to find the smallest 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 smallestVal(arr) { | |
return Math.min(...arr) | |
} | |
console.log(smallestVal([1,9,5,4,11,3,3,4,2,])); // --> 1 | |
// 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