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>
This commit is contained in:
Vse Mozhet Byt authored and Evan Lucas committed 2017-01-04 10:44:06 -06:00
1 parent ae61232493
commit b8e2711ddd
1 file changed
+6 -2
+6 -2
View File
@@ -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