Rest in destructuring collects properties that were not extracted.
const user = { name: "Mira", age: 20, city: "Lund" };
const { name, ...details } = user;
console.log(details.age, details.city);
// Output:
// 20 Lundname receives "Mira"....details collects { age: 20, city: "Lund" }, excluding name.Rest gathers properties; spread places properties into an object.
Predict the output
A book card separates its title from the remaining details. Predict which keys the details object contains.
const book = { title: "Dune", author: "Frank Herbert", pages: 412 };
const { title, ...details } = book;
console.log("Keys:", Object.keys(details).join(","));