Skip to content

Instantly share code, notes, and snippets.

@mariyadiminsky
Last active June 15, 2016 22:17
Show Gist options
  • Select an option

  • Save mariyadiminsky/100ca30cb18c3aa429e4448e1235d5b0 to your computer and use it in GitHub Desktop.

Select an option

Save mariyadiminsky/100ca30cb18c3aa429e4448e1235d5b0 to your computer and use it in GitHub Desktop.
var values = [25, 50, 75, 100]
// This:
console.log(Math.max(25, 50, 75, 100)); // => 100
// Is the same as this:
console.log(Math.max(...values)); // => 100
/*
NOTE: Math.max() typically does not work for arrays unless you write it like:
Math.max.apply(null, values), but with Spread Operators you can just insert it
and voila! No need for the .apply() part! Wohoo! :)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment