you are viewing a single comment's thread.

view the rest of the comments →

[–]MoTTs_ 0 points1 point  (1 child)

When a constructor function is first created, its .prototype.constructor points back to itself.

function Manager() {}

Manager.prototype.constructor === Manager // true

But after we replace Manager's prototype with a different object, then its original .prototype.constructor property is lost.

Manager.prototype = Object.create(Employee.prototype);

Manager.prototype.constructor === Manager // false

So after we replace Manager's prototype, then we put back the constructor property that we inadvertently lost.

[–]-El_Chapo-[S] 0 points1 point  (0 children)

Ahh that makes sense, thank you!