Created
August 11, 2017 07:52
-
-
Save iamgoangle/820c4928786601bc6f501d72d34bbabd to your computer and use it in GitHub Desktop.
call function without apply method
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
| const args = [0, 1, 2]; | |
| function foo (x, y, z) { | |
| // do stuff... | |
| // we are not using this keyword in foo() | |
| } | |
| // Call function | |
| foo.apply(null, args); | |
| // Using ... instead | |
| foo(...args); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment