Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 18:43
Show Gist options
  • Save masautt/e083d73429887f53fa384b726d82deea to your computer and use it in GitHub Desktop.
Save masautt/e083d73429887f53fa384b726d82deea to your computer and use it in GitHub Desktop.
How to find the smallest value of an array in JavaScript?
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