ivanWantsToKnow,
function Animal () {
this.run = function () {
if (this.constructor === Beaver) {
console.log('beaver running');
} else if (this.constructor === Deer) {
console.log('deer running');
}
};
}
function Beaver () {
}
Beaver.prototype = new Animal();
Beaver.prototype.constructor = Beaver;
function Deer () {
}
Deer.prototype = new Animal();
Deer.prototype.constructor = Deer;
var deer = new Beaver();
deer.run();