Menu
CoddyTech

Hello, Node

Part of the Node.js Basics section of Coddy's Node.js journey. Lesson 1 of 33.

In the JavaScript course, Coddy ran your code and showed what it printed. Node.js is the program that runs JavaScript like that, on your own computer or on a server, with no browser around it.

A Node program is a .js file. The command node weather.js runs this one, top to bottom:

const city = 'Lisbon';
console.log('Weather for ' + city);
console.log('Sunny, 24 degrees');

Each console.log prints one line in the terminal. The terminal is the window where you type commands. Beside your code, $ node notes.js is already typed for you: press Run to run it. There is no page, so document and window do not exist here. Everything else you know about JavaScript works.

challenge icon

Challenge

Easy

In this section you build notes.js, a notes tool you run from the terminal. For now it prints a greeting.

  1. Press Run. The terminal beside your code runs node notes.js and shows what it prints: Hello, Node!
  2. Change the greeting to anything you like, such as My Notes, and run it again.

Try it yourself

console.log('Hello, Node!');

All lessons in Node.js Basics

Practice on your own: Express playground