Skip to content

Commit

Permalink
doc: warn about reassigning _ in REPL
Browse files Browse the repository at this point in the history
When users assign a value to `_` in REPL, it is prone to unexpected
results or messing up with REPL's internals. For example,
nodejs#3704. This patch issues a warning
about the same.
  • Loading branch information
thefourtheye committed Nov 10, 2015
1 parent 2c33819 commit 6417f8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/repl.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ The special variable `_` (underscore) contains the result of the last expression
> _ += 1
4

*NOTE*: Explicitly assigning a value to `_` in the REPL can produce unexpected
results.

The REPL provides access to any variables in the global scope. You can expose
a variable to the REPL explicitly by assigning it to the `context` object
associated with each `REPLServer`. For example:
Expand Down

0 comments on commit 6417f8b

Please sign in to comment.