bradxr
8/5/2018 - 11:27 PM

Reset an Inherited Constructor Property

Child instance will also inherit parent's constructor

function Bird() { }
Bird.prototype = Object.create(Animal.prototype);
let duck = new Bird();
duck.constructor // function Animal(){...}


// manually set Bird constructor to the Bird object
Bird.prototype.constructor = Bird;
duck.constructor // function Bird(){...}