doc: add set some time section

This commit is contained in:
Leon Xu committed 2021-10-01 20:40:11 -07:00
1 parent d34264ca2f
commit 4cdc9cb9a3
1 file changed
+9
+9
View File
@@ -94,4 +94,13 @@ verifyPizza();
eatPizza();
// twiddle thumbs
payForPizza();
```
# 定时间
```javascript
function orderExecutor(resolve, reject) { // reject not required here
console.log('making our pizza...');
setTimeout(resolve, 5000);
}
let orderPizza = new Promise(orderExecutor);
orderPizza.then(function () { console.log('eating pizza!'); });
```