We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b5a154 commit 6223823Copy full SHA for 6223823
README.md
@@ -142,3 +142,22 @@ console.log(f2()); // undefined
142
> }
143
144
> ```
145
+
146
+---
147
148
+## :link: setTimeout order
149
150
+```javascript
151
+function orders() {
152
+ console.log(1);
153
+ setTimeout(() => console.log(2), 1000);
154
+ setTimeout(() => console.log(3), 0);
155
+ console.log(4);
156
+}
157
158
+orders() // 1, 4, 3, 2
159
+```
160
161
+## Explanation
162
163
+> The console.log executes first before the async functions (setTimout function) and then the async functions executes appending on who is the faster.
0 commit comments