JS Built-ins
ObjectObjectbeginner

Object() β€” create empty object

πŸ“– Usage Example
// Wrap a value in an Object wrapper
const obj = new Object(42)
typeof obj   // β†’ 'object'
obj.valueOf()  // β†’ 42

Use the Object constructor to explicitly wrap a primitive value in an object.

Object() constructor

new Object() creates an empty plain object, equivalent to {}.

Challenge: Implement createEmpty() that returns a new empty object using new Object().

createEmpty() // β†’ {}
πŸ’‘ Hints (2)
  • β€’ `new Object()` is equivalent to writing `{}`.
  • β€’ Each call creates a brand-new object instance.