Skip to content

Instantly share code, notes, and snippets.

@JasonCust
Last active January 22, 2017 05:10
Show Gist options
  • Save JasonCust/a6ad634bc975921e63014e0f3e88d226 to your computer and use it in GitHub Desktop.
Save JasonCust/a6ad634bc975921e63014e0f3e88d226 to your computer and use it in GitHub Desktop.
ES2015 Destructuring Assignment Example -- Basic object destructuring assignment for arguments using a Dagwood Sandwich
// The argument name syntax is a Destructuring Assignment
function makeCheeseSandwich({bread, cheeses}) {
return {bread, cheeses};
}
console.log(makeCheeseSandwich(dagwoodSandwich));
// output: { bread: 'rye', cheeses: [ 'cheddar' ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment