Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fooling around with ES2015 destructurings
var pearlJam = {
members: [
{ firstName: 'Eddie', lastName: 'Vedder' },
{ firstName: 'Mike', lastName: 'McCready' },
{ firstName: 'Jeff', lastName: 'Ament' },
]
}
let { members: [ eddieVedder ] } = pearlJam;
let { firstName: eddie } = eddieVedder;
// You cannot unfortunately write:
// let { members: [ eddieVedder: { firstName: eddie } ] } = pearlJam;
console.log(eddie);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.