Skip to content

Instantly share code, notes, and snippets.

@Schoonology
Created November 16, 2015 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Schoonology/db712e12e13f514908ba to your computer and use it in GitHub Desktop.
Save Schoonology/db712e12e13f514908ba to your computer and use it in GitHub Desktop.
Spread-call
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