Last active
January 20, 2016 20:10
-
-
Save a-double/578ad45f1de05a72803b to your computer and use it in GitHub Desktop.
ES6 default/override pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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