我想评估
var foo = "foo"; console.log(foo);
作为一个块,而不是逐行评估
var foo = "foo"; undefined console.log(foo); foo undefined
有没有简单的方法可以将提示移至下一行?
节点v6.4具有一种editor模式。在repl提示符下.editor,您可以输入多行。
editor
.editor
例
$ node > .editor // Entering editor mode (^D to finish, ^C to cancel) const fn = there => `why hello ${there}`; fn('multiline'); // hit ^D 'why hello multiline' > // 'block' gets evaluated and back in single line mode.
以下是所有特殊repl命令的文档 https://nodejs.org/api/repl.html#repl_commands_and_special_keys