Is it possible to call a regular method from a prototype method if it's been overridden? Note that in the given example the first eat() method is called from the body of the Animal function - it is the requirement.
Animal = function(){
this.eat();
};
Animal.prototype.eat = function() {
console.log("All animals eat");
};
Bear = function(){
Animal.call(this);
this.goToSleep = function(){
console.log("Bears go to sleep after they eat");
}
};
Bear.prototype = Object.create(Animal.prototype);
Bear.prototype.eat = function() {
console.log("Bears eat honey");
this.goToSleep(); //returns 'undefined is not a function'
//How do I invoke this.goToSleep() ?
};
var winnie = new Bear();
Bear.prototype.goToSleep?