← BYTES
JavaScript·Intermediate·Ref: 3.2.9

What does `Object.freeze()` do to an object?

Have a question about this video? Mention reference 3.2.9 when you contact us.

a.Deletes all of its properties
b.Converts it into a string permanently
c.Prevents adding, removing, or reassigning its OWN top-level properties (shallow freeze only)
d.Makes it deeply immutable at every nesting level automatically
`Object.freeze()` only freezes the object's own direct properties -- any nested object or array referenced by one of those properties is NOT automatically frozen too, a common gotcha when people assume it's a deep freeze.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES329#JavaScript