JSFiddle - React, Tailwind, and code Playground

by iamjpg

HTML

<div id="count">

</div>

JavaScript

function count() {
  this.count = 0;
  this.increment = function(int) {
    return this.count++;
  }
  this.add = function(val) {
    setInterval(function() {
      document.getElementById('count').innerHTML += '<div>' + count.increment(val) + '</div>';
    }, 1000)
  }
}

var count = new count();
count.add(1);