JSFiddle - React, Tailwind, and code Playground

by Kevin Faulhaber

HTML

<button id="stop">STOP</button>
<div id="container"></div>

JavaScript

var container = document.getElementById('container'),
    stop = document.getElementById('stop'),
    last = container,
    div = document.createElement('div'),
    c = 0,
    si = setInterval(function () {
        var div_temp = div.cloneNode();
        div_temp.innerHTML = c;
        last.appendChild(div_temp);
        last = div_temp;
        console.log('count is at: '+ c++);
    }, 50);

stop.onclick = function(){
    clearInterval(si);
};