Browse Source

doc: fix an output example in repl.md

Make `_` reassignment example match more with the current output.
Extend the example for more clarity.

PR-URL: https://github.com/nodejs/node/pull/10244
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Vse Mozhet Byt 8 years ago
committed by Anna Henningsen
parent
commit
4936c41194
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 8
      doc/api/repl.md

8
doc/api/repl.md

@ -140,6 +140,7 @@ global or scoped variable, the input `fs` will be evaluated on-demand as
The default evaluator will, by default, assign the result of the most recently
evaluated expression to the special variable `_` (underscore).
Explicitly setting `_` to a value will disable this behavior.
```js
> [ 'a', 'b', 'c' ]
@ -147,11 +148,14 @@ evaluated expression to the special variable `_` (underscore).
> _.length
3
> _ += 1
Expression assignment to _ now disabled.
4
> 1 + 1
2
> _
4
```
Explicitly setting `_` to a value will disable this behavior.
### Custom Evaluation Functions
When a new `repl.REPLServer` is created, a custom evaluation function may be

Loading…
Cancel
Save