JSFiddle - React, Tailwind, and code Playground
by juristr
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
var Animal = function(name){
this.name = name;
};
Animal.prototype.makeSound = function(){
console.log(this.name + ": " + (this.sound || "(bo)"));
};
var AggressiveAnimal = function(name){
Animal.call(this, name);
};
AggressiveAnimal.prototype.makeSound = function(){
console.log(this.name + " bites you!!");
};
AggressiveAnimal.prototype = Animal.prototype;
var Dog = function(name){
Animal.call(this, name);
this.sound = "wuff";
};
Dog.prototype = Object.create(AggressiveAnimal.prototype);
//test
var dog = new Dog("Bello");
//dog.makeSound();
//dog.prototype = Object.create(AggressiveAnimal);
dog.makeSound();