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: 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

Reflect.isExtensible

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

[see JS: Reflect.isExtensible]

Reference

ECMAScript® 2016 Language Specification#sec-object.isextensible

Liket it? Put $5 at patreon.

Or, Buy JavaScript in Depth

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

Web Dev Tutorials

  1. HTML
  2. Visual CSS
  3. JS in Depth
  4. JS Reference
  5. DOM
  6. SVG
  7. Web Dev Blog