What is the purpose of the this keyword inside a constructor function?

  • Refers to the global object
  • Refers to the parent object
  • Refers to the current instance
  • Refers to the next sibling
The this keyword inside a constructor function refers to the current instance of the object being created. It allows you to access and assign properties and methods to the instance being constructed, making it unique for each object created with the constructor. It does not refer to the global or parent object.
Add your answer
Loading...

Leave a comment

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