Freezing the Object You Mean
In this lesson, you lock Harbour Prints’ settings with Object.freeze() and check exactly which
objects the lock reaches. The proof card export reads the shop’s settings: its name, and a nested
limits record with a cap of 20 copies.
In Python, the settings sit in a MappingProxyType, a read-only view of a dictionary. A stray line
raises the nested copy limit to 25, past the cap, and the read-only settings let it through: the
script prints 25. The proxy refuses writes to its own keys, but the limits dictionary is a
separate object that it only points to.
In the JavaScript port, const stops a name from being reassigned. Object.freeze() locks the
object you pass it: nothing can be added to it, and its own properties can’t be removed or changed.
Watch out: freezing isn’t deep. It locks only the properties config owns, not the objects they
point to, so the same nested write follows the reference to copyLimits and changes it. JavaScript logs
25, as Python did.