Skip to content

Commit

Permalink
doc: fix examples in repl.md
Browse files Browse the repository at this point in the history
* 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 <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
vsemozhetbyt authored and evanlucas committed May 3, 2017
1 parent 373e9f0 commit 360efe4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ replServer.defineCommand('sayhello', {
this.displayPrompt();
}
});
replServer.defineCommand('saybye', () => {
replServer.defineCommand('saybye', function saybye() {
console.log('Goodbye!');
this.close();
});
Expand Down Expand Up @@ -440,6 +440,8 @@ without passing any arguments (or by passing the `-i` argument):
```js
$ node
> const a = [1, 2, 3];
undefined
> a
[ 1, 2, 3 ]
> a.forEach((v) => {
... console.log(v);
Expand Down

0 comments on commit 360efe4

Please sign in to comment.