Skip to content

Commit c3aefeb

Browse files
committed
Update index.md
1 parent a76e8c7 commit c3aefeb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

assets/index.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,31 +163,31 @@ The setImmediate() method is used to execute a function right after the current
163163
/**
164164
* setImmediate() and process.nextTick()
165165
*/
166-
setImmediate(() => {
167-
console.log("1st Immediate");
168-
});
166+
console.log("Program Started");
169167

170168
setImmediate(() => {
171-
console.log("2nd Immediate");
169+
console.log("setImmediate()");
172170
});
173171

174172
process.nextTick(() => {
175-
console.log("1st Process");
173+
console.log("process.nextTick()");
176174
});
177175

178-
process.nextTick(() => {
179-
console.log("2nd Process");
180-
});
176+
setTimeout(()=> {
177+
console.log('setTimeout()');
178+
}, 0);
181179

182-
// First event queue ends here
183-
console.log("Program Started");
180+
console.log("Program Ends");
181+
```
184182

185-
// Output
183+
**Output:**
184+
185+
```js
186186
Program Started
187-
1st Process
188-
2nd Process
189-
1st Immediate
190-
2nd Immediate
187+
Program Ends
188+
process.nextTick()
189+
setTimeout()
190+
setImmediate()
191191
```
192192

193193
<div align="right">

0 commit comments

Comments
 (0)