doc: add a count down classic example section

This commit is contained in:
Leon Xu committed 2021-10-01 21:01:27 -07:00
1 parent 0b3030af14
commit 071903925c
1 file changed
+11
+11
View File
@@ -11,3 +11,14 @@ cover: >-
abbrlink: 142d93dd
date: 2021-10-01 18:59:39
---
# 倒数 — 一个经典的循环问题
```javascript
function startCountDown() {
let count = 10;
for (let i = count; i > 0; i--) {
console.log(i + '...');
}
console.log("0!");
}
```
一旦它被调用,就会在控制台打印一个倒计时。但是如果我们想要将打印的每一行延迟1秒呢?