Prototypes Exploring

by Ishank Dubey

JavaScript

function Animal(){

this.walk= function(){
console.log("Animal Walk");
};
};

function Dog(){
    this.walk = function(){
    Dog.prototype.walk();
    console.log("Dog Walk");
    };
};

Dog.prototype = new Animal();

var aDog = new Dog();

aDog.walk();