JSFiddle - React, Tailwind, and code Playground
JavaScript
let index = 0;
const arr = [1, 2, 3];
const timer = setInterval(() => {
if (index === arr.length) {
clearInterval(timer);
return;
}
console.log(arr[index++]);
}, 3000);