Skip to content

Instantly share code, notes, and snippets.

@nateplusplus
Last active June 11, 2017 16:44
Show Gist options
  • Save nateplusplus/e48469b9617254c172589e1113b510bc to your computer and use it in GitHub Desktop.
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
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