Last active
June 11, 2017 16:44
-
-
Save nateplusplus/e48469b9617254c172589e1113b510bc to your computer and use it in GitHub Desktop.
ES2017 Spread Properties Example - An example of using spread properties in ES2017 for my blog at https://natehub.blogspot.com/2017/05/the-future-of-javascript-and-beyond.html
This file contains 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
function lookupRecord(id, ...otherParams) { | |
return db.lookup( | |
"people-records", id, ...otherParams | |
); | |
} | |
function getSomeData() { | |
var someVals = [2,3]; | |
return [1,...someVals,4]; | |
} | |
var [ | |
a, | |
b, | |
...otherVals | |
] = getSomeData(); | |
otherVals; | |
// [3,4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment