类:REPLServer


【Class: REPLServer

可以使用 repl.start() 方法创建 repl.REPLServer 的实例,或者直接使用 JavaScript 的 new 关键字。

【Instances of repl.REPLServer are created using the repl.start() method or directly using the JavaScript new keyword.】

import repl from 'node:repl';

const options = { useColors: true };

const firstInstance = repl.start(options);
const secondInstance = new repl.REPLServer(options);const repl = require('node:repl');

const options = { useColors: true };

const firstInstance = repl.start(options);
const secondInstance = new repl.REPLServer(options);