JS: Object.isExtensible

JS: Object.isExtensible


Return true if a object obj is an object and is extensible, else false.

[see JS: Object Type]

Extensible means properties can be added.

[see JS: Prevent Adding Property]

// check if a object is extensible

console.log( Object.isExtensible( {} )); // true
// return false for non object
console.log( Object.isExtensible( 3 )); // false


If using ES2015, use Reflect.isExtensible instead. It throws error if argument is not object.

[see JS: Reflect.isExtensible]

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials