JSFiddle - React, Tailwind, and code Playground

by alexdickson

HTML

<div id="phrase">phrase</div>

JavaScript

var showPhrase = function(phrases, start) {

    var showNext = function() {
        $('#phrase').html(phrases[start]).slideDown('slow').delay(1000).fadeOut('slow', function() {
            start++;
            if (start < phrases.length) {
                showNext();
            }
        });

    }

    showNext();

}


showPhrase(['a', 'b', 'c'], 0);