diff options
Diffstat (limited to 'doc/api/repl.md')
-rw-r--r-- | doc/api/repl.md | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/api/repl.md b/doc/api/repl.md index dff2f8f51d7..e5d2fa41d6c 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -40,6 +40,7 @@ The following special commands are supported by all REPL instances: `> .load ./file/to/load.js` * `.editor` - Enter editor mode (`<ctrl>-D` to finish, `<ctrl>-C` to cancel) +<!-- eslint-disable --> ```js > .editor // Entering editor mode (^D to finish, ^C to cancel) @@ -75,6 +76,7 @@ evaluation function when the `repl.REPLServer` instance is created. The default evaluator supports direct evaluation of JavaScript expressions: +<!-- eslint-disable --> ```js > 1 + 1 2 @@ -103,6 +105,7 @@ repl.start('> ').context.m = msg; Properties in the `context` object appear as local within the REPL: +<!-- eslint-disable --> ```js $ node repl_test.js > m @@ -132,6 +135,7 @@ REPL environment when used. For instance, unless otherwise declared as a global or scoped variable, the input `fs` will be evaluated on-demand as `global.fs = require('fs')`. +<!-- eslint-disable --> ```js > fs.createReadStream('./some/file'); ``` @@ -142,6 +146,7 @@ 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. +<!-- eslint-disable --> ```js > [ 'a', 'b', 'c' ] [ 'a', 'b', 'c' ] @@ -288,6 +293,7 @@ r.on('reset', initializeContext); When this code is executed, the global `'m'` variable can be modified but then reset to its initial value using the `.clear` command: +<!-- eslint-disable --> ```js $ ./node example.js > m @@ -438,6 +444,7 @@ Node.js itself uses the `repl` module to provide its own interactive interface for executing JavaScript. This can be used by executing the Node.js binary without passing any arguments (or by passing the `-i` argument): +<!-- eslint-disable --> ```js $ node > const a = [1, 2, 3]; |