Object.isFrozen()

ES5+

Determines if an object is frozen.

Syntax

Object.isFrozen(obj)

Parameters

obj Object

The object to check

Return Value

boolean

true if the object is frozen, otherwise false

Examples

JavaScript
const obj = { a: 1 };
console.log(Object.isFrozen(obj));
Object.freeze(obj);
console.log(Object.isFrozen(obj));
Output:
// false true

Related Methods