Merge pull request #1735 from javascript-tutorial/paroche-patch-13

Update article.md
This commit is contained in:
Peter Roche 2020-02-02 22:49:55 -07:00 committed by GitHub
commit b30915ae4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -143,7 +143,7 @@ But we can wrap it into an anonymous async function, like this:
````
````smart header="`await` accepts \"thenables\""
Like `promise.then`, `await` allows to use thenable objects (those with a callable `then` method). The idea is that a third-party object may not be a promise, but promise-compatible: if it supports `.then`, that's enough to use with `await`.
Like `promise.then`, `await` allows us to use thenable objects (those with a callable `then` method). The idea is that a third-party object may not be a promise, but promise-compatible: if it supports `.then`, that's enough to use it with `await`.
Here's a demo `Thenable` class; the `await` below accepts its instances: