我刚接触Node.js
,我想知道有没有一种方法可以在Node shell内部执行JavaScript文件。让我这样解释:
不是这样做:
$ node file.js
它会执行脚本,但之后会关闭Node shell...
有没有一种方法可以在Node shell内部执行脚本?类似于这样:
$ node
> file.js # We're now inside the Node.js shell
... script execution...
> # already inside the shell,
# then being able to access to script variables