Skip to content

Commit b8e2711

Browse files
vsemozhetbytevanlucas
authored andcommitted
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: #10244 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent ae61232 commit b8e2711

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/repl.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,22 @@ global or scoped variable, the input `fs` will be evaluated on-demand as
140140

141141
The default evaluator will, by default, assign the result of the most recently
142142
evaluated expression to the special variable `_` (underscore).
143+
Explicitly setting `_` to a value will disable this behavior.
143144

144145
```js
145146
> [ 'a', 'b', 'c' ]
146147
[ 'a', 'b', 'c' ]
147148
> _.length
148149
3
149150
> _ += 1
151+
Expression assignment to _ now disabled.
152+
4
153+
> 1 + 1
154+
2
155+
> _
150156
4
151157
```
152158

153-
Explicitly setting `_` to a value will disable this behavior.
154-
155159
### Custom Evaluation Functions
156160

157161
When a new `repl.REPLServer` is created, a custom evaluation function may be

0 commit comments

Comments
 (0)