JSFiddle - React, Tailwind, and code Playground
JavaScript
function Animal() {
this.name = null;
this.hairColor = null;
this.legs = 4;
};
Animal.prototype = {
getName : function() {
return this.name;
},
getColor : function() {
console.log("The hair color is " + this.hairColor);
}
}
function Dog() {
}
Dog.prototype = new Animal;
Dog.prototype.bark = function() {
console.log("Woof! My name is " + this.name);
};
var myDog = new Dog;
myDog.bark();
myDog.getColor();