JS Built-ins
ObjectObject.createintermediate

Object.create(null) β€” no prototype

πŸ“– Usage Example
// Create an object with a specific prototype
const proto = { greet() { return 'hi' } }
const child = Object.create(proto)
child.greet()   // β†’ 'hi'

Use Object.create() to create a new object with a specific prototype, enabling prototype-based inheritance.

Object.create(null)

Object.create(null) creates an object with no prototype at all β€” not even Object.prototype. This is useful for plain dictionaries that cannot be polluted by inherited properties.

Challenge: Implement createNullProto() that returns an object created with Object.create(null).

Object.getPrototypeOf(createNullProto()) // β†’ null
πŸ’‘ Hints (2)
  • β€’ `Object.create(null)` produces a truly empty object β€” no `toString`, no `hasOwnProperty`.
  • β€’ Use `Object.getPrototypeOf(obj) === null` to confirm.