1

Being a beginner in JavaScript, I wonder what is the purpose of .prototype.constructor? What is the purpose of

Function Foo(a) {
  this.a = a,
  this.b = b
}

What exactly is a constructor function? Thank you.

von spotz
  • 875
  • 7
  • 17
  • Every object in js contains the ```constructor``` property, which is just a reference to the function used to create this object. In practice you will rarely use, unless you try to invoke it dynamically or doing any reflection related tasks – Two Horses Mar 12 '21 at 15:54

0 Answers0