JSFiddle - React, Tailwind, and code Playground
by KyleMuir
JavaScript
var Adder = function () {
var count = 0;
this.add = function (itemToAdd) {
count+=itemToAdd;
}
this.whatsMyCount = function () {
console.log('my count is ' + count); //alert('my count is' + count) if you cant
//figure out the console, use alert instead.
}
};
var calcInstance = new Adder();
calcInstance.add(12);
calcInstance.whatsMyCount(); //logs 12