Skip to content

Instantly share code, notes, and snippets.

@QuocCao-dev
Created September 25, 2022 08:36
Show Gist options
  • Save QuocCao-dev/2cb1d216f00bbc248ca32687d332699e to your computer and use it in GitHub Desktop.
Save QuocCao-dev/2cb1d216f00bbc248ca32687d332699e to your computer and use it in GitHub Desktop.
const person = {
first: "Alberto",
last: "Montalesi",
};
const { first: firstName, last: lastName } = person;
console.log(firstName, lastName); // console.log(firstName , lastName)
const person = {
name: "Alberto",
last: "Montalesi",
links: {
social: {
facebook: "https://www.facebook.com/alberto.montalesi",
},
website: "http://albertomontalesi.github.io/",
},
};
// const facebook = person.links.social.facebook;
// destructuring
// nested destructuring
const {
links,
links: { social },
links: {social: { facebook }, },
} = person;
console.log(social);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment