JSFiddle - React, Tailwind, and code Playground

by obobruyko

JavaScript

var animal = {
    name: "Animal",
    getName: function(){
        return this.name;
    },
    says: function() {
        return this.saying || "";
    }
};

var cat = Object.create(animal);
cat.name = "Sima";
cat.saying = "meow";
cat.purr = function() {
    console.log("purrrrrrrrrrrrrrrr");
};

console.log(cat.name);
console.log(cat.says());
console.log(cat.purr());