Skip to content

Commit a876c4e

Browse files
authored
Update README.md
1 parent 85f7cae commit a876c4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Use nextTick() when you want to make sure that in the next event loop iteration
122122
start();
123123
```
124124
___
125-
### ES6 introduced Promises.
125+
### <a name="promises"></a>📖 ES6 introduced Promises.
126126

127127
&emsp;We can create a promise, using a Promise constructor that receives a callback.<br>
128128
> *A Promise is an object that contains a status and a value.*
@@ -195,7 +195,7 @@ ___
195195
&emsp;We ``fetch`` some JSON data via an HTTP request. The **fetch function** returns a **promise**, which will either ``resolve`` or ``reject``. The **response body** has a json method for parsing the response from JSON to an object. ``.then`` returns a promise of its own, which handle by attaching another ``.then`` handler, and in case of **error** we attach a ``catch`` handler and log the error.
196196

197197
___
198-
### ES7 introduced Async/Await.
198+
### <a name="asyncAwait"></a>📖 ES7 introduced Async/Await.
199199
&emsp;With the async and await keywords, we can create async functions which implicitly return a promise.<br>
200200

201201
&emsp;When encountering an ``await`` keyword, the execution of the ``async function`` body gets paused ✋🏼. And the rest of the ``async function`` gets run in a **microtask** instead of a regular task. In that time the ***JS engine*** jumps out of the async function and continues running the code in the ***execution context*** in which the async function got called 🏃🏽‍♀️ (_for example, the global execution context_).

0 commit comments

Comments
 (0)