JSFiddle - React, Tailwind, and code Playground

by Anik Islam Abhi

JavaScript

var IceCream = function (flavor) {
  this.tub = 100;
  this.flavor = flavor;
};

IceCream.prototype = { 
        scoop : function () {
            this.updateInventory(); alert("scooping");
        },
        updateInventory : function () {
            this.tub --;
        alert(this.tub);
        }
};

 var vanilla = new IceCream("vanilla");
 vanilla.scoop();