Reflect.isExtensible(target) checks whether you can add new properties to an object. It returns true for a normal object, and false if the object has been locked with Object.preventExtensions(), Object.seal() or Object.freeze().
It only talks about adding properties. A non-extensible object may still allow you to change or delete the properties it already has.
Remember
Reflect.isExtensible(target)
normal object → true
preventExtensions() → false
seal() → false
freeze() → false
Once false, it never becomes true again
target must be an object, or TypeError
Three ways to lock. Each of the three objects is non-extensible, so Reflect.isExtensible() gives false every time.
Empty objects are special. These objects have no properties, so there is nothing to change or delete. That is why isSealed() and isFrozen() also say true for all three.
Use a bigger object to see more. With real properties, preventExtensions() would give isSealed() as false. The next page, Reflect.preventExtensions(), shows this.
Example 3 — Primitives and Errors
Compare the older Object.isExtensible() with Reflect for values that are not objects. The catch block prints the error type only.
Object with 5: false
Reflect with 5: TypeError
Reflect with null: TypeError
Array: true
Function: true
How It Works
The older method is forgiving.Object.isExtensible(5) treats a primitive as "not extensible" and answers false.
Reflect is strict. A number and null are not objects, so Reflect.isExtensible() throws a TypeError for both. This catches mistakes early.
Arrays and functions are objects. They are extensible by default, so both answers are true.
Compatibility
Browser & Runtime Support
Reflect.isExtensible() is part of ES2015 (ES6), together with the Reflect object. Every current browser and Node.js has it.
✓ ES2015 · Widely supported
Reflect.isExtensible()
Supported in Chrome 49+, Edge 12+, Firefox 42+, Safari 10+, Opera 36+ and Node.js 6+. Internet Explorer never got it.
ES2015Standard since
Google Chrome49+ · Desktop & Mobile
Full support
Microsoft Edge12+ · Chromium and legacy
Full support
Mozilla Firefox42+ · Desktop & Mobile
Full support
Apple Safari10+ · macOS & iOS
Full support
Opera36+ · Chromium based
Full support
Samsung InternetRecent versions · Android
Supported
Android WebView49+ · Chromium based
Supported
Node.js6+ · Server runtime
Supported
DenoSupported · JavaScript runtime
Supported
BunSupported · JavaScript runtime
Supported
Internet ExplorerNo native support
Not supported
Reflect.isExtensible()Excellent
Bottom line: Safe to use in every current browser and in Node.js. The only thing to plan for is Internet Explorer, which has no Reflect at all.
Frequently Asked Questions
It checks whether you can add new properties to an object. It returns true for a normal object and false for an object that was locked with preventExtensions(), seal() or freeze().
No. It only means that new properties cannot be added. A non-extensible object can still allow changes and deletions. Use Object.isSealed() and Object.isFrozen() for the stricter levels.
No. Locking is permanent. There is no method that makes an object extensible again, so make a copy if you need a version that can grow.
For objects they are the same. For primitives, Object.isExtensible(5) returns false, while Reflect.isExtensible(5) throws a TypeError.
It helps libraries and Proxy handlers behave correctly. For example, code that adds a hidden property to an object can first check that the object is still extensible.