concept JavaScript file in category node

appears as: JavaScript files, JavaScript file
Get Programming with Node.js

This is an excerpt from Manning's book Get Programming with Node.js.

In this lesson, you write and run your first JavaScript file with Node.js. At the end, I show you how to import JavaScript files into REPL so you can work with prewritten code.

Figure 2.1. Running a JavaScript file with Node.js
Listing 2.2. Loading a JavaScript file into REPL
> .load messages.js
"use strict";
let messages = [
  "A change of environment can be a good thing!",
  "You will make it!",
  "Just run with the code!"
];                              #1

2.1. Creating a JavaScript file

To get started with your first Node.js application, create a JavaScript file to print a message to the terminal console. To do that, follow these steps: