In this lesson, we’ll explore some of the functionality and properties specific to the Node environment, but first, let’s see how we run a program.
We’ll need to create a file with a
.js extension. We’ll call ours myProgram.js. Next, we’ll open that file with a text editor and add our code:
// Inside myProgram.js console.log('Hello World');
Our code is complete! Now, we want to execute it. We’ll open our terminal and navigate to the directory that contains myProgram.js. Finally, we’ll type the command
node myProgram.js into our terminal.
$ node myProgram.js
The results of our program will print to the terminal.
Let’s write a program and run it in Node.
'____'. Replace each of them with words of the designated type:
let adjective = 'silly';
When you’re ready to move on to the next step, click the “Check Work” button.
Let’s run the program in the terminal so we can see its output. Type
node app.js in the terminal and press enter or return, and then press “Check Work”. You should see the output of the program in the terminal!