[Solved] Change label text every two seconds and wait executing following cos [closed]


I’m not sure that I understood correctly..

Maybe you need something like this?

function func_code() {
    var codes = "100000,100004,100007,100009,100012";
    var code_arr = codes.split(',');
    for (i = 0;i < code_arr.length;i++) {
        (function(i){
            setTimeout(function(){ 
                change_number(code_arr[i]);
            }, 2000*i);
        })(i)
    }
}
                  
function change_number(i) {
    document.getElementById('counter').innerHTML = i;
}

func_code();
<div id="counter"></div>

3

solved Change label text every two seconds and wait executing following cos [closed]