Object.isFrozen()

Determines whether an object is frozen.

Since ES5 Spec ↗

Syntax

Object.isFrozen(obj)

Parameters

NameTypeRequiredDescription
obj object Yes The object to test.

Returns

boolean — true if the object is frozen; otherwise false.

Examples

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

Notes

Primitives are considered frozen and return true (since ES2015). An object is frozen when it is non-extensible and all its own properties are non-configurable and non-writable.

Browser & runtime support

EnvironmentSince version
chrome 6
firefox 4
safari 5.1
edge 12
node 0.10

See also