Where this matters
Passing an object between parts of a program can share mutable data. A second variable name does not provide an independent snapshot.
const first = { points: 1 };
const second = first;
second.points = 4;
console.log(first.points);Read the full explanation
Both bindings refer to the same object. Mutation through second is visible through first.
Trace the code
- first refers to an object with points set to 1.
- Assigning first to second copies the reference to that object.
- Changing points through second changes the object that first also reads.
Why the other predictions differ
1— Assignment copies the reference, not the object.TypeError— Const permits changing a property on the existing object.
4
Reading this explanation does not record mastery. A correct submitted attempt can do so, including after review.
Change one thing
Make a new outer object using spread before changing its numeric property.
Predict the result, then run this self-contained snippet in your browser’s developer console. It uses only sample values and makes no network requests.
const first = { points: 1 }; const second = { ...first }; second.points = 4; console.log(first.points);Check the variation’s output
1
Explain which binding, value, or operation changed before moving to the next challenge.