doc: add a count down classic example section
This commit is contained in:
1 parent
fc3f4b0d99
commit
a47bb171e6
1 file changed
+11
@@ -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秒呢?
|
||||
Reference in new issue
Block a user