Skip to content

Commit 993dc77

Browse files
committed
Update index.md
1 parent c3aefeb commit 993dc77

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

assets/index.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ eventEmitter.on('listenerOne', listenerTwo); // Register for listenerOne
9797

9898
// When the event "listenerOne" is emitted, both the above callbacks should be invoked.
9999
eventEmitter.emit('listenerOne');
100+
```
101+
102+
**Output:**
100103

101-
// Output
104+
```js
102105
First Listener Executed
103106
Second Listener Executed
104107
```
@@ -118,8 +121,11 @@ function listenerOnce() {
118121

119122
eventEmitter.once('listenerOne', listenerOnce); // Register listenerOnce
120123
eventEmitter.emit('listenerOne');
124+
```
121125

122-
// Output
126+
**Output:**
127+
128+
```js
123129
listenerOnce fired once
124130
```
125131

@@ -138,8 +144,11 @@ function listener(code, msg) {
138144

139145
eventEmitter.on('status', listener); // Register listener
140146
eventEmitter.emit('status', 200, 'ok');
147+
```
141148

142-
// Output
149+
**Output:**
150+
151+
```js
143152
status 200 and ok
144153
```
145154

@@ -211,14 +220,19 @@ function myAsync(a, b, callback) {
211220
callback(a + b);
212221
}, 100);
213222
}
223+
214224
console.log("Before Asynchronous Call");
215225

216226
myAsync(10, 20, function (result) {
217227
console.log("Sum: " + result);
218228
});
229+
219230
console.log("After Asynchronous Call");
231+
```
232+
233+
**Output:**
220234

221-
// Output
235+
```js
222236
Before Asynchronous Call
223237
After Asynchronous Call
224238
Sum: 30

0 commit comments

Comments
 (0)