Created
November 16, 2015 16:18
-
-
Save Schoonology/db712e12e13f514908ba to your computer and use it in GitHub Desktop.
Spread-call
This file contains 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 arr = [1, 2, 3]; | |
function foo(a, b, c){ | |
console.log("this", this); | |
console.log("a", a); | |
console.log("b", b); | |
console.log("c", c); | |
} | |
foo(...arr); // Regular fn call | |
foo.apply("fake", arr); // Apply for `this` support. | |
foo.call("fake", ...arr); // More natural call for `this` support. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment