mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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:
1 parent
ae61232493
commit
b8e2711ddd
1 file changed
+6
-2
+6
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user