How can you create an object in JavaScript that does not inherit the prototype from Object?

  • Object.create(null)
  • Object() constructor
  • {} constructor
  • Object.assign({})
In JavaScript, you can create an object that does not inherit the prototype from Object by using Object.create(null). This creates an object with no prototype, making it a clean slate. The other options either inherit from Object or use Object's prototype.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *