JSFiddle - React, Tailwind, and code Playground

HTML

<div id="spin" style="width:200px;height:200px;background:#00ff00">click</div>
<div id="rouletteWheel" style="width:200px;height:200px;background:#00ffff;color:#fff"></div>

JavaScript

$('#spin').click(function(){
    counter = 0;
    howManyTimes = 10;
    var interval = setInterval(function () {
        counter++
            if(counter === howManyTimes) {
                clearInterval(interval);
                alert('game over');
            } else {
                var rouletteNum = Math.floor((Math.random() * 36) + 1);
                $('#rouletteWheel').html(rouletteNum);
                var color = ['red', 'black']
                var i = [Math.floor(Math.random()*color.length)];
                $('#rouletteWheel').css('background-color', color[i]);
            }
    },100);
    
   interval();
});