Skip to content

Commit e8ae4ba

Browse files
vsemozhetbytevanlucas
authored andcommitted
doc: fix examples in repl.md
* Update an example according to an actual REPL session. * Replace an arrow function with a common function to hold `this`. PR-URL: #12684 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 2f13fc1 commit e8ae4ba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/api/repl.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ replServer.defineCommand('sayhello', {
335335
this.displayPrompt();
336336
}
337337
});
338-
replServer.defineCommand('saybye', () => {
338+
replServer.defineCommand('saybye', function saybye() {
339339
console.log('Goodbye!');
340340
this.close();
341341
});
@@ -440,6 +440,8 @@ without passing any arguments (or by passing the `-i` argument):
440440
```js
441441
$ node
442442
> const a = [1, 2, 3];
443+
undefined
444+
> a
443445
[ 1, 2, 3 ]
444446
> a.forEach((v) => {
445447
... console.log(v);

0 commit comments

Comments
 (0)