Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f06d33d

Browse files
committed
incorporated comment from Jason on .catch()
1 parent d09002b commit f06d33d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fundamentals/promises.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ If you are only interested in the error case, you can pass `null` for the first
8181
somePromise.then(null, onRejected)
8282
```
8383

84-
or you can use a second method exposed by a promise, which is just a short-hand for calling `then()` with `null` as its first argument:
84+
or you can use another method available on a promise, which is just a shorthand for calling `then()` with `null` as its first argument:
8585

8686
```js
87-
somePromise.catch(onRejected)
87+
somePromise
88+
.then(onFulfilled)
89+
.catch(onRejected)
8890
```
8991

9092
> Note that `onFulfilled` and `onRejected` execute asynchronously, after the [event loop](./event_loop.md) turn in which then is called, and with a fresh stack.

0 commit comments

Comments
 (0)