Skip to content

Instantly share code, notes, and snippets.

@ilearnjavascript
Created March 27, 2019 23:43
Show Gist options
  • Save ilearnjavascript/2e0b6d9c21ba434849a40644f2cb5c95 to your computer and use it in GitHub Desktop.
Save ilearnjavascript/2e0b6d9c21ba434849a40644f2cb5c95 to your computer and use it in GitHub Desktop.
es6 - rest parameter - 1.js
var restParameter = function(firstname, lastname, ...adress) {
console.log('firstname: ', firstname);
console.log('lastname: ', lastname);
console.log('adress: ', adress);
}
restParameter('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