JSFiddle - React, Tailwind, and code Playground

HTML

<div></div>

CSS

div {
    
 position: absolute;
top: 0px;
 left: 0px;
width:50px;
 height: 50px;
background-color:red;    
}

JavaScript

(function loop(i){
    
    if( i >= 500 ) {
       return;   
    }
    
    document.querySelector("div").style.left = i + "px";
    
    setTimeout(function(){
        loop( i + 1 );
    }, 16 );
    
})(0)