Skip to content

Commit b588049

Browse files
committed
setTimeOut Example
1 parent 2ed6e0f commit b588049

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

timing-events/setTimeOut/example.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
function timer(x, y, duration) {
2+
for (let i = x; i <= y; i++) {
3+
setTimeout(() => {
4+
console.log(i);
5+
}, duration * i);
6+
}
7+
}
8+
timer(1, 5, 500);
9+
timer(10, 20, 1500);

0 commit comments

Comments
 (0)