JSFiddle - React, Tailwind, and code Playground

HTML

<div id="count"></div>
<div id="move"></div>

CSS

#move{width: 100px; height: 100px; background-color: black}

JavaScript

$(document).ready(function(){
    var margin = 10;
    var maxCalls = 5;
    var callIndex = 0;
    var interval = setInterval(function(){
        move();
        callIndex++;
    }, 1000);
    
    function move(){
        if (callIndex >= maxCalls) clearInterval(interval);
        var txt = "margin-top: " + margin + "px";
        $('#move').animate({marginTop: margin}, 500)
        $('#count').text(txt);
        margin += 10;
    }
});