How to use setTimeout to work through an array.
Answer to http://stackoverflow.com/questions/20360122/javascript-automated-clicking
by lddubeau
JavaScript
var my_array = ["a", "b", "c", "d"];
function step(index) {
console.log("value of my_array at " + index + ":", my_array[index]);
if (index < my_array.length - 1)
setTimeout(step, 3000, index + 1);
}
setTimeout(step, 3000, 0);