@@ -42,8 +42,7 @@ The following special commands are supported by all REPL instances:
42
42
` > .load ./file/to/load.js `
43
43
* ` .editor ` - Enter editor mode (` <ctrl>-D ` to finish, ` <ctrl>-C ` to cancel).
44
44
45
- <!-- eslint-skip -->
46
- ``` js
45
+ ``` console
47
46
> .editor
48
47
// Entering editor mode (^D to finish, ^C to cancel)
49
48
function welcome(name) {
@@ -78,8 +77,7 @@ evaluation function when the [`repl.REPLServer`][] instance is created.
78
77
79
78
The default evaluator supports direct evaluation of JavaScript expressions:
80
79
81
- <!-- eslint-skip -->
82
- ``` js
80
+ ``` console
83
81
> 1 + 1
84
82
2
85
83
> const m = 2
@@ -107,8 +105,7 @@ repl.start('> ').context.m = msg;
107
105
108
106
Properties in the ` context ` object appear as local within the REPL:
109
107
110
- <!-- eslint-skip -->
111
- ``` js
108
+ ``` console
112
109
$ node repl_test.js
113
110
> m
114
111
'message'
@@ -136,8 +133,7 @@ REPL environment when used. For instance, unless otherwise declared as a
136
133
global or scoped variable, the input ` fs ` will be evaluated on-demand as
137
134
` global.fs = require('fs') ` .
138
135
139
- <!-- eslint-skip -->
140
- ``` js
136
+ ``` console
141
137
> fs.createReadStream(' ./some/file' );
142
138
```
143
139
@@ -164,8 +160,7 @@ The default evaluator will, by default, assign the result of the most recently
164
160
evaluated expression to the special variable ` _ ` (underscore).
165
161
Explicitly setting ` _ ` to a value will disable this behavior.
166
162
167
- <!-- eslint-skip -->
168
- ``` js
163
+ ``` console
169
164
> [ ' a' , ' b' , ' c' ]
170
165
[ 'a', 'b', 'c' ]
171
166
> _.length
@@ -182,8 +177,7 @@ Expression assignment to _ now disabled.
182
177
Similarly, ` _error ` will refer to the last seen error, if there was any.
183
178
Explicitly setting ` _error ` to a value will disable this behavior.
184
179
185
- <!-- eslint-skip -->
186
- ``` js
180
+ ``` console
187
181
> throw new Error(' foo' );
188
182
Error: foo
189
183
> _error.message
@@ -195,8 +189,7 @@ Error: foo
195
189
With the [ ` --experimental-repl-await ` ] [ ] command line option specified,
196
190
experimental support for the ` await ` keyword is enabled.
197
191
198
- <!-- eslint-skip -->
199
- ``` js
192
+ ``` console
200
193
> await Promise.resolve(123)
201
194
123
202
195
> await Promise.reject(new Error(' REPL await' ))
@@ -341,8 +334,7 @@ r.on('reset', initializeContext);
341
334
When this code is executed, the global ` 'm' ` variable can be modified but then
342
335
reset to its initial value using the ` .clear ` command:
343
336
344
- <!-- eslint-skip -->
345
- ``` js
337
+ ``` console
346
338
$ ./node example.js
347
339
> m
348
340
'test'
@@ -534,8 +526,7 @@ Node.js itself uses the `repl` module to provide its own interactive interface
534
526
for executing JavaScript. This can be used by executing the Node.js binary
535
527
without passing any arguments (or by passing the ` -i ` argument):
536
528
537
- <!-- eslint-skip -->
538
- ``` js
529
+ ``` console
539
530
$ node
540
531
> const a = [1, 2, 3];
541
532
undefined
0 commit comments