Skip to content

Instantly share code, notes, and snippets.

@TheCodingLady
Last active March 29, 2018 10:17
Show Gist options
  • Save TheCodingLady/0538a15b172a63995b9e7f93de27a94e to your computer and use it in GitHub Desktop.
Save TheCodingLady/0538a15b172a63995b9e7f93de27a94e to your computer and use it in GitHub Desktop.
Spread syntax, rest param and default value
const address = {
city: "Lyon",
state: "FR",
zip: 69001
};
const sportList = ['Football', 'BasketBall'];
const otherSportList = ['Boxe', 'Judo'];
function display(address = {city: 'La Loupe'}, sportList, ...rest) {
sportList.push(...rest);
console.log({address.city + " :" + sportList)
}
display(address, sportList, othersportList);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment