A copy that is not a copy

Take your time, follow the code and check your understanding.

The codeObjects
const original = {points: 1};
const copy = original;
copy.points = 2; // original should stay unchanged
Your answer3 min · no timer
What needs fixing?

Show solution and explanation

Assignment copies the reference. Spread creates a shallow copy suitable for this flat object.

Use const copy = {...original}.