JSFiddle - React, Tailwind, and code Playground

by rogeriolino

HTML

<h1 id="work">...</h1>

JavaScript

var myArray = ["life", "hardship", "culture", "woman", "Money"];
    
var work = document.getElementById("work");

function showMessages(index) {
    if (!index || index >= myArray.length) {
        index = 0;
    }
    work.innerHTML = myArray[index];
    setTimeout(function () {
        showMessages(index + 1);
    }, 3000);
}

showMessages();