JS: Object.isExtensible

JS: Object.isExtensible

Object.isExtensible(obj)

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

[see JS: What's Object?]

Extensible means properties can be added.

[see JS: Prevent Adding Property]

// check if a object is extensible (that is, if properties can be added)

console.log( Object.isExtensible( {} )); // true

Reflect.isExtensible

If using ES2015, use Reflect.isExtensible instead.

[see JS: Reflect.isExtensible]

Reference

ECMAScript® 2016 Language Specification#sec-object.isextensible

Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth