JS Built-ins
ObjectObject.isSealedintermediate

Object.isSealed() β€” using in practice

πŸ“– Usage Example
// Check if an object is sealed
const obj = { a: 1 }
Object.isSealed(obj)    // β†’ false
Object.seal(obj)
Object.isSealed(obj)    // β†’ true

Use Object.isSealed() to check whether an object's properties cannot be added or removed (though values may still change).

Object.isSealed() β€” practical guard

Use Object.isSealed() to check object integrity before attempting structural changes.

Challenge: Implement tryDeleteProperty(obj, key) that deletes the property only if the object is not sealed, returning whether it was deleted.

πŸ’‘ Hints (1)
  • β€’ isSealed is useful for defensive programming