File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -163,31 +163,31 @@ The setImmediate() method is used to execute a function right after the current
163
163
/**
164
164
* setImmediate() and process.nextTick()
165
165
*/
166
- setImmediate (() => {
167
- console .log (" 1st Immediate" );
168
- });
166
+ console .log (" Program Started" );
169
167
170
168
setImmediate (() => {
171
- console .log (" 2nd Immediate " );
169
+ console .log (" setImmediate() " );
172
170
});
173
171
174
172
process .nextTick (() => {
175
- console .log (" 1st Process " );
173
+ console .log (" process.nextTick() " );
176
174
});
177
175
178
- process . nextTick (() => {
179
- console .log (" 2nd Process " );
180
- });
176
+ setTimeout (()=> {
177
+ console .log (' setTimeout() ' );
178
+ }, 0 );
181
179
182
- // First event queue ends here
183
- console . log ( " Program Started " );
180
+ console . log ( " Program Ends " );
181
+ ```
184
182
185
- // Output
183
+ ** Output:**
184
+
185
+ ``` js
186
186
Program Started
187
- 1st Process
188
- 2nd Process
189
- 1st Immediate
190
- 2nd Immediate
187
+ Program Ends
188
+ process . nextTick ()
189
+ setTimeout ()
190
+ setImmediate ()
191
191
```
192
192
193
193
<div align =" right " >
You can’t perform that action at this time.
0 commit comments