JSFiddle - React, Tailwind, and code Playground

JavaScript

var list = ['one','two','three'];

var x = 0;

var loopArray = function(arr) {
    // call itself
    customAlert(arr[x],function(){
        // set x to next item
        x++;
        // any more items in array?
        if(x < arr.length) {
         	loopArray(arr);   
        }
    }); 
}

// start 'loop'
loopArray(list);

function customAlert(msg,callback) {
    // fancy code to show your message
	//
    console.log(msg);
    // do callback when ready
    callback();
}