Skip to content

Instantly share code, notes, and snippets.

@iamgoangle
Created August 11, 2017 07:52
Show Gist options
  • Select an option

  • Save iamgoangle/820c4928786601bc6f501d72d34bbabd to your computer and use it in GitHub Desktop.

Select an option

Save iamgoangle/820c4928786601bc6f501d72d34bbabd to your computer and use it in GitHub Desktop.
call function without apply method
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