JS: Reflect.isExtensible

By Xah Lee. Date: . Last updated: .

(new in ECMAScript 2015)

Reflect.isExtensible(obj)

Return true if obj is extensible. Else, false.

If arg is not an object, throw TypeError.

🟢 tip: this is a better version of Object.isExtensible because it throw error if arg is not object.

const jj = {};
console.assert(Reflect.isExtensible(jj));
Reflect.preventExtensions(jj);
console.assert(Reflect.isExtensible(jj) === false);