What happens to the prototype chain when using Object.create(null) in JavaScript?

  • It creates an empty object with no prototype
  • It inherits from the Object prototype
  • It inherits from the null prototype
  • It creates an object with its own prototype chain
Using Object.create(null) in JavaScript creates an empty object with no prototype, effectively removing it from the prototype chain. This is useful in scenarios where you want to create objects without inheriting any properties or methods from the default Object prototype.
Add your answer
Loading...

Leave a comment

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