Setting up Node.js
If Node.js is installed correctly, you should see the version number printed in the terminal.
Running a Script File
// myScript.js console.log("Hello, World!");
Save the file, and then open your terminal in the same directory where the script is saved. To run the script, simply type the following command:
The output of the script (“Hello, World!”) should appear in the terminal.
Executing Code Directly in the Terminal
> console.log("Hello, World!") Hello, World! undefined > 2 + 3 5 >
To exit the Node.js REPL, press Ctrl + C twice or type .exit and press Enter.