Home JavaScript Object Methods isExtensible() JavaScript Object.isExtensible() Method Definition Object.isExtensible(obj) returns true when you can still add new own properties to obj. Ordinary objects start as extensible.
After Object.preventExtensions(), Object.seal(), or Object.freeze(), the object is no longer extensible, so this method returns false.
Syntax Call Object.isExtensible() like this. Start with this line.
Call What it does Object.isExtensible(obj)Returns true if new own properties may be added to obj.
Built into JavaScript. Call on Object — no import required.
Library declarations isExtensible(o: object): boolean; Parameters Parameter Description obj Required. The object to test. In modern engines, non-objects return false without throwing.
Return Value Return Value Description boolean true if the object is extensible; false if extensions are prevented (or the value is not an object).
JavaScript Examples 1. Basic use 2. preventExtensions 3. seal and freeze Example 1 — Basic Use Normal objects are extensible until you lock them down.
var user = { name: "Ada" };
console.log(Object.isExtensible(user));
user.age = 36;
console.log(user.age);
console.log(Object.isExtensible(user)); How It Works Default is open A fresh object literal is extensible, so isExtensible returns true.Add a property Because it is extensible, assigning user.age works.Still extensible Adding properties does not change the extensible flag by itself.Example 2 — preventExtensions Block new properties and confirm with isExtensible.
var box = { n: 1 };
Object.preventExtensions(box);
console.log(Object.isExtensible(box));
box.n = 2;
box.extra = 3;
console.log(box.n);
console.log(box.extra); How It Works Lock extensions Object.preventExtensions(box) stops new own keys from being added.Flag flips Object.isExtensible(box) now returns false.Existing keys still change Updating box.n works; adding extra fails silently in non-strict mode.Example 3 — seal and freeze Sealed and frozen objects are also non-extensible.
var a = { x: 1 };
var b = { y: 2 };
Object.seal(a);
Object.freeze(b);
console.log(Object.isExtensible(a));
console.log(Object.isExtensible(b));
console.log(Object.isSealed(a));
console.log(Object.isFrozen(b)); How It Works seal blocks new keys Object.seal marks the object non-extensible and makes existing keys non-configurable.freeze is stricter Object.freeze also makes data properties non-writable.Both fail isExtensible Either way, Object.isExtensible returns false.Compatibility
Browser & Runtime Support Object.isExtensible() has been available since ES5 . It is Baseline and safe for all modern environments.
✓ Baseline · ES5
Object.isExtensible() Supported in all modern browsers and Node.js alongside preventExtensions, seal, and freeze.
99% Modern browser support
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support Object.isExtensible Excellent
Bottom line: Use with preventExtensions, seal, and freeze to reason about object mutability.
Frequently Asked Questions What does Object.isExtensible() do? It returns true if new own properties can still be added to the object, and false after preventExtensions, seal, or freeze.
Are sealed or frozen objects extensible? No. Both seal and freeze make an object non-extensible, so isExtensible returns false.
Can I change existing properties on a non-extensible object? Often yes. preventExtensions only blocks new properties. seal and freeze add more restrictions on existing keys.
Does isExtensible check the prototype? No. It only reports whether that object itself can gain new own properties.
What about primitives? In modern JavaScript, Object.isExtensible on a non-object returns false. It does not throw.
About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
8 people found this page helpful
Helpful Share Copy link Suggestion