I need to clear the timeout and I couldn’t figure how. I’m not sure what to pass on the clearTimeout method from window object… any tips?
for (var k = 0; k <= arr2.length; k++) {
(function (k) {
window.setTimeout(function () {
//do something
}, 6000 * k);
})(k);
}
Since you are creating
arr2.lengthamount of timers, if you need “kill” a specific timer, you need an array of references.to clear a specific one, do: