Object.freeze() Freeze an object
Last updated: 2026-09-09
Object.freeze() Freeze an object
Object.freeze makes an object immutable: no add, delete or modify. Shallow freeze only.
| Category | Objects |
|---|---|
| ES version | ES5 |
📝 Syntax
Object.freeze(obj);
⚙️ Parameters
| obj | The object to freeze. |
|---|
Returns:The frozen object (same reference).
Mutates the original:Yes (in place)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
5000
true
💡 Tip freeze locks the binding, not the value — recursively freeze for deep immutability.
⚠️ Warning Shallow freeze — nested objects are still mutable.
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| Object.freeze() | ✓ v1 | ✓ v12 | ✓ v1.5 | ✓ v3 | ✓ v10.5 |
| Supported by all modern browsers | |||||
🏷️ Related Objects
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
QObject.freeze vs const?
Aconst locks the binding; freeze locks the object's properties.
QIs freeze deep?
ANo — shallow only. Recursively freeze for deep.
QCan you unfreeze?
ANo — freeze is irreversible. Create a copy with {...obj}.