1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 18:32:22 +00:00

docs(promise): fix #1028

This commit is contained in:
ruanyf 2020-12-22 23:41:42 +08:00
parent cc2420e644
commit 1c99572bc7

View File

@ -52,7 +52,7 @@ promise.then(function(value) {
});
```
`then`方法可以接受两个回调函数作为参数。第一个回调函数是`Promise`对象的状态变为`resolved`时调用,第二个回调函数是`Promise`对象的状态变为`rejected`时调用。其中,第二个函数是可选的,不一定要提供。这两个函数都接受`Promise`对象传出的值作为参数。
`then`方法可以接受两个回调函数作为参数。第一个回调函数是`Promise`对象的状态变为`resolved`时调用,第二个回调函数是`Promise`对象的状态变为`rejected`时调用。这两个函数都是可选的,不一定要提供。它们都接受`Promise`对象传出的值作为参数。
下面是一个`Promise`对象的简单例子。