diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-04-27 04:25:38 +0300 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-04-29 01:56:16 +0300 |
commit | 8092fb0a59927159ec68c914771c6be484116203 (patch) | |
tree | 628469d61e3b7d604345b9d890f7fd0ae65f15e3 /doc | |
parent | 0101a8f1a6eb363e1ae5ac7aca19223e37025f78 (diff) | |
download | android-node-v8-8092fb0a59927159ec68c914771c6be484116203.tar.gz android-node-v8-8092fb0a59927159ec68c914771c6be484116203.tar.bz2 android-node-v8-8092fb0a59927159ec68c914771c6be484116203.zip |
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: https://github.com/nodejs/node/pull/12684
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/repl.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/doc/api/repl.md b/doc/api/repl.md index b15142910f..60c200699a 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -341,7 +341,7 @@ replServer.defineCommand('sayhello', { this.displayPrompt(); } }); -replServer.defineCommand('saybye', () => { +replServer.defineCommand('saybye', function saybye() { console.log('Goodbye!'); this.close(); }); @@ -448,6 +448,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); |