JSFiddle - React, Tailwind, and code Playground

HTML

<button onclick="mouseup()">Run Code
    </button>

JavaScript

function mouseup (  )
{
    var i=0;
    var myVar = setInterval(function(){
        
        alert("test")
        i++;
        if(i===6){clearInterval(myVar);}                      
    },1000);
    
}