I want the following code to execute a specified number of times at intervals of one second. Currently, it continues running indefinitely. Can anyone tell me what I'm doing wrong?
Code:
function clickHandler() {
var passes = 0;
var interval = setInterval(someMethod, 1);
};
function someMethod() {
passes++;
if (passes > 199) {
clearInterval(interval);
}
};
}
Thanks in advance for any responses.