Skip to content

Instantly share code, notes, and snippets.

@sarahquigley
Created May 2, 2018 20:55
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 sarahquigley/4768a9a4bef39db15a7cc0adf600ca3d to your computer and use it in GitHub Desktop.
Save sarahquigley/4768a9a4bef39db15a7cc0adf600ca3d to your computer and use it in GitHub Desktop.
Example of ES6 Rest Parameters - Arguments for Variadic Functions
/* ES5 */
var actions = [ 'Slash', 'Hiss', 'Yowl'];
catFight.apply(undefined, actions);
// > 'Slash! Hiss! Yowl!'
/* >= ES6 */
var actions = [ 'Slash', 'Hiss', 'Yowl'];
catFight(...actions);
// > 'Slash! Hiss! Yowl!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment