Suppose you have 3 arrays you want to loop over, with lengths x, y, and z, and for each loop, you want to update a progress bar. For example:
function run()
If you want to use setTimeout you could capture the x, y, z and count variables into a closure:
function run() { var x = 100, y = 100, z = 10, count = 0; for (var i=0; i
Live demo.