JSFiddle - React, Tailwind, and code Playground

HTML

<div id="num">123</div>

JavaScript

(function () {
    var MyTest;

    MyTest = (function () {
      //constructor
      function MyTest() {
        this.counter = document.getElementById('num');
      }
      
      MyTest.prototype.setCount = function(count) {
        return this.counter.innerHTML = count;
      };
      MyTest.prototype.currentCount = function() {
        return parseInt(this.counter.innerHTML);
      };
      MyTest.prototype.incrementCount = function() {
        return this.setCount(this.currentCount() + 1);
      };
      MyTest.prototype.decrementCount = function() {
        return this.setCount(this.currentCount() - 1);
      };
      
      return MyTest;
    })();
    
    var instance = new MyTest();
    
    instance.setCount(321);
    
    instance.incrementCount();
    instance.incrementCount();
    instance.incrementCount();
    
  }.call(this));