setInterval repeatedly schedules a callback until it is explicitly cleared. Its delay is not a promise of exact execution time: JavaScript tasks can postpone callbacks, and a new interval firing is dropped when that interval already has a task waiting in the queue. section 13.2.1
Listing 13.3. Pseudocode for our time-out and interval demo
<button id="myButton"></button>
<script>
setTimeout(function timeoutHandler(){ #A
/*Some timeout handle code that runs for 6ms*/ #A
}, 10); #A
setInterval(function intervalHandler(){ #B
/*Some interval handle code that runs for 8ms*/ #B
}, 10); #B
const myButton = document.getElementById("myButton");
myButton.addEventListener("click", function clickHandler(){ #C
/*Some click handle code that runs for 10ms*/ #C
}); #C
/*Code that runs for 18ms*/
</script>
See the interval callback alongside a timeout, a click handler, and long-running mainline code in the scheduling example. section 13.2.1
