guys i've been trying to solve this for the last couple of days. I really need your help and I want to understand whats going on. My Function will iterate once and the go back to the first value, how can I make it so that the loops starts from zero and keeps on looping. I've tried while loops but thos attempts have been unsuccessful. Thank you guys!
function run() {
    for (let i = 0; i <= imgArray.length; i++) {
        (function (e) {
            setTimeout(function () {
                if (i == imgArray.length) {
                    i = 0;
                }
                imgContainer.style.background = imgArray[i];
            }, 3000 * e);
        })(i);
    };
}