What is a constructor function in JavaScript?
A function that creates an object with specific properties and behavior.
A function that returns a new object when invoked with the 'new' keyword.
A function that is used to define the prototype of an object.
A function that is used to modify the existing properties of an object.
A constructor function is a special type of function in JavaScript that is used to create and initialize objects. It is typically invoked with the 'new' keyword, which creates a new object and sets the constructor function as the prototype of that object. Constructor functions can have parameters that are used to set the initial state of the object and can also define methods and properties that are shared by all instances of the object.