Last active
June 15, 2016 22:17
-
-
Save mariyadiminsky/100ca30cb18c3aa429e4448e1235d5b0 to your computer and use it in GitHub Desktop.
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
| 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