Objects
An object groups properties under keys. A property holds a value, and multiple variables can refer to the same object.
A record keeps an article’s related data together; copying its reference does not copy the record.
See the mechanism
object AfalseFollow one example
Both bindings refer to one object. Updating saved through sameArticle is visible through article. const prevents rebinding article, not changing its writable properties. A missing property normally reads as undefined. A new object literal creates a distinct object even when its properties look identical. Destructuring extracts the title property. Object spread makes a shallow copy with saved replaced; nested objects would still be shared. Optional chaining stops a property access when its receiver is null or undefined, and ?? supplies the missing-author fallback.
Predict, change and check
Predict: If sameArticle is replaced with a separate literal containing the same fields, does the update still reach article?
Test your explanation: Try the separate literal and compare === and saved. Draw two objects instead of one to explain the changed outcome.
The tasks below ask you to explain that result and apply the idea to different inputs.
Apply and distinguish
References are values too
Assigning an object to a second variable copies the reference value, not a recursively independent record. Changing a field through one reference is visible through another reference to the same object. Reassigning one variable to a new object does not retarget the other variable.
Object spread creates a new outer object but nested object references can remain shared. Decide whether a feature needs shared state, a shallow copy, or a deeper cloning strategy and document which value types are supported. Object identity comparisons do not recursively compare fields; two records can look identical while remaining distinct objects.
Check your understanding: State the input contract, identify the operation that changes the result, and give one boundary input that would distinguish the correct rule from the mistake described above.