Skip to content

Instantly share code, notes, and snippets.

@a-double
Last active January 20, 2016 20:10
Show Gist options
  • Select an option

  • Save a-double/578ad45f1de05a72803b to your computer and use it in GitHub Desktop.

Select an option

Save a-double/578ad45f1de05a72803b to your computer and use it in GitHub Desktop.
ES6 default/override pattern
// https://gist.github.com/ericelliott/f3c2a53a1d4100539f71
// Eric Elliott
function foo({
param = 'stuff',
another = 'things'
} = {}) {
return `${param} and ${things}`;
}
console.log( foo() ); // 'stuff and things'
console.log( foo({ param: 'whatever' }); // 'whatever and things'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment