Skip to content

Commit cc2e6ca

Browse files
committed
docs(promise): edit promise
1 parent 9ecf067 commit cc2e6ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/promise.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ p2
179179
// Error: fail
180180
```
181181

182-
上面代码中,`p1`是一个Promise,3秒之后变为`rejected``p2`的状态在1秒之后改变,`resolve`方法返回的是`p1`此时,由于`p2`返回的是另一个Promise,所以后面的`then`语句都变成针对后者(`p1`)。又过了2秒,`p1`变为`rejected`,导致触发`catch`方法指定的回调函数。
182+
上面代码中,`p1`是一个Promise,3秒之后变为`rejected``p2`的状态在1秒之后改变,`resolve`方法返回的是`p1`。由于`p2`返回的是另一个 Promise,导致`p2`自己的状态无效了,由`p1`的状态决定`p2`的状态。所以,后面的`then`语句都变成针对后者(`p1`)。又过了2秒,`p1`变为`rejected`,导致触发`catch`方法指定的回调函数。
183183

184184
## Promise.prototype.then()
185185

0 commit comments

Comments
 (0)