Skip to content

Instantly share code, notes, and snippets.

@colintoh
Last active August 29, 2015 14:07
Show Gist options
  • Save colintoh/9a2ab8b853b3e0f9615a to your computer and use it in GitHub Desktop.
Save colintoh/9a2ab8b853b3e0f9615a to your computer and use it in GitHub Desktop.
//Without Rest Parameters
function rollCall(){
var names = Array.prototype.slice.call(arguments);
names.forEach(function(name){
console.log(name);
});
}
//With Rest Parameters
function rollCallWithRest(...names){
names.forEach(function(name){
console.log(name);
});
}
rollCall("John","Mary");
rollCallWithRest("James","May","Jeremy","Clarkson");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment