What does the `new` keyword do when used with a constructor function?

JavaScript Associate Easy

JavaScript Associate — Easy

What does the `new` keyword do when used with a constructor function?

Key points

  • The `new` keyword is essential for creating instances of constructor functions
  • It ensures that the new object inherits properties and methods from the constructor's prototype
  • `this` refers to the newly created object within the constructor function

Ready to go further?

Related questions