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