JSFiddle - React, Tailwind, and code Playground

HTML

<div id="message"></div>

JavaScript

function nextMsg(i) {
    if (messages.length == i) {
        i = 0;
    }
    $('#message').html(messages[i]).fadeIn(500).delay(1000).fadeOut(500, function() {
        nextMsg(i + 1);
    });
};

var messages = [
    "Hello!",
    "This is a website!",
    "You are now going to be redirected.",
    "Are you ready?",
    "You're now being redirected..."
    ];

$('#message').hide();

nextMsg(0);