function Animal(name) {
    this.name = name;
    this.kingdome = "Animal";
}
Animal.prototype.speak = function() {
    console.log("My name is " + this.name);
};

function Cat(name) {
    Animal.call(this, name);
    this.sound="Miew";
}
Cat.prototype = new Animal();
function Dog(name) {
    Animal.call(this, name);
    this.sound="Woff";
}
Dog.prototype = new Animal();


mydog=new Dog("Caro");
mycat=new Cat("Garfield");
mycat.speak();

Animal.prototype.makeSound = function() {
    console.log(this.sound);
};

mycat.makeSound();

Se även MDN

DN

SVD DN2