Object privileges - can not be extended - internal features

1, object permissions

The internal characteristics of the object:

Whether [[Extensible]] can add properties - Detection Object.isExtensible ()

Setting: Object.preventExtensions ()

var son = {
  name: 'ad'
}
Object.preventExtensions(son);
son.age = 23;
console.log(son.age in son) //false;
console.log(son.age) //undefined

Object seal: Object.seal () - equivalent to the object feature [[Extensible]] = false property characteristics [[Configurable]] = false

Object.isSealed()

isFrozen()

Object freezing: - equivalent to the object seal + [[Writable]] = false

2, object property rights

Guess you like

Origin www.cnblogs.com/yuyedaocao/p/12073929.html