From e8ae4ba487cd3927de81cd0165dc0a6bd484cc69 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Thu, 27 Apr 2017 04:25:38 +0300 Subject: [PATCH] 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 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/repl.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/repl.md b/doc/api/repl.md index 8c2f56ccbd3820..728178df4ccad0 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -335,7 +335,7 @@ replServer.defineCommand('sayhello', { this.displayPrompt(); } }); -replServer.defineCommand('saybye', () => { +replServer.defineCommand('saybye', function saybye() { console.log('Goodbye!'); this.close(); }); @@ -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);