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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
vsemozhetbyt authored and evanlucas committed May 1, 2017
1 parent a48fbeb commit 1359030
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 1359030

Please sign in to comment.