Object destructuring reads properties into variables with matching names.
const book = { title: "Dune", pages: 412 };
const { title, pages } = book;
console.log(title, pages);
// Output:
// Dune 412title receives book.title: "Dune".pages receives book.pages: 412.Names determine which properties are read; { pages, title } would give the same values.
Predict the output
A course card extracts fields in a different order from their declaration. Predict the printed values.
const course = { lessons: 12, title: "JavaScript" };
const { title, lessons } = course;
console.log(title, lessons);