The ... syntax has two related jobs: spread expands existing values into a new array or object, while rest collects the values left over by a pattern or parameter list.
const profile = { name: "Noor", theme: "light" };
const updatedProfile = { ...profile, theme: "dark" };
const scores = [12, 18];
const allScores = [...scores, 21];
console.log(profile.theme); // light
console.log(updatedProfile.theme); // darkYou’ll copy and combine collections, gather remaining values, and perform immutable updates. Creating a new value instead of mutating the old one makes changes easier to track and prepares you for state-driven interfaces.