JS: Object.preventExtensions
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);