Help Me Simplify this


#1

function Penguin(name) {
this.name = name;
this.numLegs = 2;
}
Penguin.prototype.sayName=function() {
console.log("Hi my Name is"+" "+this.name+" "+"and i have"+ " "+this.numLegs+" "+"legs");
}

    function Emperor(name){
        this.name=name;
        }
        Emperor.prototype= new Penguin(this.numLegs);
        var emperor= new Emperor("Umesh");
        emperor.sayName();
        console.log(emperor.numLegs);

#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.