Skip to content

Instantly share code, notes, and snippets.

@webdesignberlin
Forked from emilong/simple-es6.js
Created October 16, 2016 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdesignberlin/46d4b80519307e292549348324753dbc to your computer and use it in GitHub Desktop.
Save webdesignberlin/46d4b80519307e292549348324753dbc to your computer and use it in GitHub Desktop.
// can destructure arrays
const [a, b] = [1,2]; // a = 1, b = 2
// can destructure object keys
const { a } = { a: 3 }; // a = 3
// even function parameters
function foo({ a }) {
console.log(a);
}
foo({ a: 4 }); // prints 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment