JSFiddle - React, Tailwind, and code Playground

by bittersweetryan

JavaScript

var Cat = function(name){
    this.name = name;
};
    
Cat.prototype.getName = function(){
    return this.name;
}
    
var ShortHare = function(name){    
    
};

ShortHare.prototype = new Cat();


Cat.prototype.speak = function(){
    console.log("Meow!");    
};

var bart = new Cat("Bart");
var maggie = new ShortHare("Maggie");

console.log(bart.getName());
console.log(maggie.getName());