Hey there I'm not new to programming nor javascript but I'm new to the object oriented world of javascript as it differs from languages I know such as java, c# when it comes to object oriented apsects.
Basically I'd like to know is this the way to do inheritance in javascript, how can I improve it, and what pit falls to watch out for thanks
function Animal(name, age, color){
this.name = name;
this.age = age;
this.color = color;
}
Animal.prototype.describeMe = function(){
console.log("Hello I am " + this.name + " and I am " + this.age + " years old and my color is " + this.color);
};
function Dog(name, age, color, breed){
Animal.call(this, name, age, color);
this.breed = breed;
}
Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.whatAmI = function(){
console.log("I am a dog");
}
var dog = new Dog("Max", 10, "red", "German Shepard");
dog.whatAmI();
dog.describeMe();