Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Created October 25, 2016 01:50
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 matthieu-D/04cfd48069dd1c74774572b7e6b20d7c to your computer and use it in GitHub Desktop.
Save matthieu-D/04cfd48069dd1c74774572b7e6b20d7c to your computer and use it in GitHub Desktop.
const [ a, b, c ] = [1,2,3];
console.log(b) // 2
const [ d, , f ] = [4,5,6];
console.log(f); // 6
const { id, surname, name } = {age:26, name: 'Matthieu'};
console.log(name); // Only name is defined so: Matthieu
const { test='Default value'} = {};
console.log(test);
// Default value
const {address} = {address: {street: 'Here', city:'There'}};
console.log(address);
// Object {street: "Here", city: "There"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment