Object.isFrozen
Determines if an object is frozen
Syntax
Object.isFrozen(obj)Parameters
| Parameter | Type | Description |
|---|---|---|
| obj | any | The object to check |
Return Value
true if the object is frozen, false otherwise
Examples
const obj = { a: 1 };
console.log(Object.isFrozen(obj)); // false
Object.freeze(obj);
console.log(Object.isFrozen(obj)); // trueconsole.log(Object.isFrozen(42)); // true (primitives are frozen)
console.log(Object.isFrozen('hello')); // trueconst empty = {};
Object.preventExtensions(empty);
console.log(Object.isFrozen(empty)); // trueUnderstanding Object.isFrozen
The Object.isFrozen method in JavaScript determines if an object is frozen. It belongs to the Object object and is one of the most widely used methods for working with object values in modern JavaScript and TypeScript applications.
The method signature is Object.isFrozen(obj). It accepts 1 parameter: obj. When called, it returns true if the object is frozen, false otherwise. Understanding when and how to use isFrozen() helps you write more expressive, readable code.
Common use cases for Object.isFrozen include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like object-freeze, object-seal, object-issealed, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for Object.isFrozen is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
Object.freezeFreezes an object, preventing new properties from being added, existing properties from being removed, and existing properties from being changed
Object.sealSeals an object, preventing new properties from being added and marking all existing properties as non-configurable
Object.isSealedDetermines if an object is sealed
More Object Methods
Other methods in the Object object
Related Tools
More Object Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.