JavaScript: Object.preventExtensions

By Xah Lee. Date: . Last updated: .
Object.preventExtensions(obj)
  • Make obj not extensible.
  • Return obj.
  • No error if obj is not a object type.

Tip: use Reflect.preventExtensions instead.

// make an object not extensible
const jj = {};
Object.preventExtensions(jj);
console.log(Object.isExtensible(jj) === false);

JavaScript Prevent Change Property

BUY
ΣJS
JavaScript in Depth

JS Obj Reference

Object Object

prototype