Skip to content

Commit

Permalink
doc: fix an output example in repl.md
Browse files Browse the repository at this point in the history
Make `_` reassignment example match more with the current output.
Extend the example for more clarity.

PR-URL: #10244
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
vsemozhetbyt authored and evanlucas committed Jan 4, 2017
1 parent ae61232 commit b8e2711
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,22 @@ 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' ]
[ 'a', 'b', 'c' ]
> _.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
Expand Down

0 comments on commit b8e2711

Please sign in to comment.