JS Built-ins
ObjectObject.isExtensibleintermediate

Object.isExtensible() β€” after freeze

πŸ“– Usage Example
// Check if new properties can be added
const obj = { a: 1 }
Object.isExtensible(obj)             // β†’ true
Object.preventExtensions(obj)
Object.isExtensible(obj)             // β†’ false

Use Object.isExtensible() to check whether new properties can still be added to an object.

Object.isExtensible() after freeze

Object.freeze(obj) makes an object non-extensible, non-configurable, and non-writable.

Challenge: Implement isFrozenAndNonExtensible(obj) that returns true when the object is both frozen and not extensible.

πŸ’‘ Hints (1)
  • β€’ freeze implies non-extensible