Execute files with Node on local

Hi Forum,

I’m just starting the Full stack engineer path, and I reached the Node.JS lesson:
Running JavaScript | Codecademy

On the console I am able to execute a file in two ways with the following commands:
‘node hello.js’
.load ./hello.js’

Is there any difference? Why do we need the .load prefix?

Thank you for the support!

‘node hello.js’ you would use from the command line and would be the most common way of starting a node script. However, if you have the Node REPL (Read Evaluate Print Loop) open (by typing just ‘node’) then you can use .load to load a script as that is how loading a js-file is done from inside the REPL. You may find it useful to open the REPL for different reasons such as testing some code, doing quick math/logic or learning some JS without dealing with the code-editor…