It's time to run JavaScript code using Node.
First, create a new JavaScript file named chapter-01.js from the command prompt:
touch chapter-01.jsNext, add this line of code into the file:
console.log("Hello, World!");Now let's run the script with Node by running this command:
node chapter-01.jsThe console will reply with printing "Hello, World!" into the console.
You've just ran your very first JavaScript code using Node.js. Congratulations!
Granted, this is not the most useful program in the world, but this small piece of code proves that you can run JavaScript perfectly.