JSFiddle - React, Tailwind, and code Playground

HTML

<div id="square"></div>

CSS

#square {
    width: 100px;
    height: 100px;
    background-color: red;
    position: relative;
}

JavaScript

var square = document.getElementById('square');

for (var i = 0; i <= 3; i++) {
    setTimeout(setLeft(square, i * 100), i * 1000);
}

function setLeft(element, offset) {
  return function() {
    element.style.left = offset + 'px';
  };
}