testo
testo

Reputation: 1250

How can I run a javascript from inside a node.js console?

I can run script.js from the commandline with node script.js.

When I just type node I enter the interactive console and see a prompt. How can I execute script.js from there?

Upvotes: 1

Views: 153

Answers (1)

Mureinik
Mureinik

Reputation: 310993

One option is to require it:

require('./script')

Upvotes: 1

Related Questions