Fundamentals / Objects
Objects
Key-value collections — with destructuring and spread to reshape them.
An object groups named properties together. Destructuring pulls properties out into standalone variables: `const { name } = user`. The spread operator `{ ...user }` copies an object's own enumerable properties into a new object — but only one level deep, which is why it's called a shallow copy.
Codeeditable — Run executes your edits
Loading...
Console
Output will appear here
Visualization
State
Step through — the console panel shows what's happening
Why?
Spread copies top-level keys into a fresh object, so clone and user are different objects in memory — changing one never affects the other, as long as their values are primitives.