This commit is contained in:
Ilya Kantor 2016-11-14 16:31:21 +03:00
parent 3defacc09d
commit f99574f53b
178 changed files with 530 additions and 271 deletions

View file

@ -1,30 +0,0 @@
importance: 4
---
# Rewrite setTimeout with setInterval
Rewrite the split counting function from setTimeout to setInterval:
```js run
let i = 0;
let start = Date.now();
function count() {
if (i == 1000000000) {
alert("Done in " + (Date.now() - start) + 'ms');
} else {
setTimeout(count, 0);
}
for(let j = 0; j < 1000000; j++) {
i++;
}
}
count();
```