javascript async
by John Doe
HTML
<input type="button" onclick="test()" id="button" value="Нажми меня">
JavaScript
function test() {
var counter = 0,
limit = 10000000000,
handle,
action = function() {
if (counter >= limit) {
clearTimeout(handle);
return;
}
console.log(counter);
counter++;
handle = setTimeout(action, 0);
};
action();
};
test();