I worked on a blog on the constructor property of a function object and came across this line:
The prototype property of the Object function has a constructor property set by the function itself
Value, next function object
function Student(name,age) { this.name = name; this.age = age; }
will have the following prototype
{constructor : Student}
function Student() { } console.log(Student.prototype); console.log(Student.prototype.constructor); console.log(Student.prototype.constructor.prototype); console.log(Student.prototype.constructor.prototype.constructor); console.log(Student.prototype.constructor.prototype.constructor.prototype);
which means that the prototype has a constructor property, which is set by the function itself, which has the same prototype object. It has some reasons, or it was just a feature of the language. I could not find any reason to have a circular link here.
Any help appreciated. Thanks.
source share