sdras/object-explorer

Objec.isSealed example is misleading

nicolo-ribaudo opened this issue · 4 comments

let obj = {
  a: 1,
  b: 2,
  c: 3
};

Object.defineProperty(obj, 'a', {
  configurable: false
})

console.log(Object.isSealed(obj)); // false
console.log(Object.isSealed(obj.a)); // true

Initially I thoght that Object.isSealed(obj.a) checked if the a property of obj is not configurable, but it returns true just because obj.a is not an object. A good example would actually seal obj.


EDIT:
Also the description isn't very clear:

Determines if an object or its properties are sealed.

What does it mean that "its properties are sealed"? WDYT about "Determines if the descriptor of its properties can't be changed and new properties can't be created"?

sdras commented

Ah good point, I'll update this. Thanks

This changes all the translations, right?

Yes 👍