Skip to content

Instantly share code, notes, and snippets.

@emilong
Created October 13, 2016 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emilong/16c6d7136eea1fceb650b72fd58c3a36 to your computer and use it in GitHub Desktop.
Save emilong/16c6d7136eea1fceb650b72fd58c3a36 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