Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 18:42
Show Gist options
  • Select an option

  • Save masautt/c666b85dc77ba2b0d913162a5e55548a to your computer and use it in GitHub Desktop.

Select an option

Save masautt/c666b85dc77ba2b0d913162a5e55548a to your computer and use it in GitHub Desktop.
How to find the largest value of an array in JavaScript?
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