const todo = {
id: 1,
firstName: "David",
lastName: "Mchale",
age: 40,
user: {
isLoggedIn: false,
},
};
// using curly braces means we are destructuring
// NOT using curly braces and using ':' means we are just renaming
const {
id: position, // renaming
firstName,
lastName,
age,
user: { isLoggedIn }, // getting the value from the user isLoggedIn
} = todo;
console.log("destructure => ", firstName, lastName, age, isLoggedIn, position);