Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created September 16, 2019 15:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NyaGarcia/acda431acc93bf7d295d6a24a4b14da5 to your computer and use it in GitHub Desktop.
Save NyaGarcia/acda431acc93bf7d295d6a24a4b14da5 to your computer and use it in GitHub Desktop.
Passing array elements by index to Math.max function
const numbers = [1, 4, 5];
const max = Math.max(numbers[0], numbers[1], numbers[2]);
console.log(max); //Result: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment