JSFiddle - React, Tailwind, and code Playground

JavaScript

function myClass()
{
    this.myArray = new Array(1, 2, 3, 4, 5, 6, 7, 8);
    var that = this;
    setInterval(function() { that.slideLoop() }, 1000);
}

myClass.prototype.slideLoop = function()
{
    document.write( this.myArray[0] + '<br>' );
    this.myArray.splice(0,1);
}
    
var inst = new myClass();