I am trying to loop a function but I need the loop to pause, execute the function, then continue the loop. The function takes around 1 to 5 minutes to finish. Then I want to unpause the loop and redo the function 20 times.
What I've tried so far:
for(i = 0; i < 20; i++) {
//Some function here
}
do {
var i = 0
// Some function here
i++
} while (i < 20)