Skip to content
AgileLogics
4 min read

Your First JavaScript Program

Prerequisites: Installing Node.js

Create a file named hello.js containing:

console.log("Hello, world!");

Run it with Node from a terminal, in the same folder as the file:

node hello.js

Expected output

Hello, world!

console.log() prints a value to the console — it's the first tool reached for when checking what a program is actually doing, both in Node and in a browser.

Common mistakes

  • Forgetting the semicolon at the end of a statement — JavaScript often works without it (via "automatic semicolon insertion"), but omitting them consistently can cause subtle bugs in a few edge cases. Most style guides recommend always including them.