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 obj is not object, throw a TypeError exception.

🟢 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) === true);
Reflect.preventExtensions(jj);
console.assert(Reflect.isExtensible(jj) === false);

JavaScript. Prevent Change Property