Skip to content

Instantly share code, notes, and snippets.

@ilearnjavascript
Created March 27, 2019 23:43
Show Gist options
  • Save ilearnjavascript/8c70d3a3e366a22ed837a934366c8354 to your computer and use it in GitHub Desktop.
Save ilearnjavascript/8c70d3a3e366a22ed837a934366c8354 to your computer and use it in GitHub Desktop.
es6 - rest parameter - 2.js
var restParameterWithSpread = function (firstname, lastname, ...adress) {
console.log('firstname: ', firstname);
console.log('lastname: ', lastname);
console.log('adress: ', ...adress);
}
restParameterWithSpread('John', 'Doe', 'Example Street 1', '12345', 'Exampletown');
// outputs:
// firstname: John
// lastname: Doe
// adress: Example Street 1 12345 Exampletown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment