The JS prototype constructor points to the constructor

is not very good at expressing, for example:

function Person () {

}

Why does the constructor in Person"s prototype prototype point to Person ()? I don"t know much about it and I don"t find any answers on the Internet.

Dec.10,2021

  1. constructor, prototype and prototype chain
  2. 33 concepts that JavaScript developers should understand

  

every time a function is created, its prototype object is created at the same time, and this object also automatically gets the constructor property.
so Person.prototype.constructor itself points to Person, because you need to specify it manually because you rewrite the original constructor override

Menu