Introduction

Node.js takes the JavaScript engine out of the browser — specifically V8, the same one Chrome uses — and runs it directly on a machine, with no page, no DOM, and no window object in sight. That one change turns JavaScript into a language for servers, command-line tools, and scripts that read files or talk over a network.

Installing and checking your version

Node is installed separately from any browser. Once it's installed, checking the version confirms it's on your PATH:

bash terminal
node --version
Output
v22.11.0

Running your first script

Save a file, then hand it to the node command — no build step, no bundler, just a JS file executed directly:

JS hello.js
console.log("Hello from Node!");
bash terminal
node hello.js
Output
Hello from Node!

What's missing (and what's new)

Browser-only globals simply don't exist here — there's no page to manipulate:

JS no-window.js
console.log(typeof window);
console.log(typeof document);
Output
undefined
undefined

In exchange, Node adds APIs a browser would never allow a webpage to touch for security reasons — reading and writing files, opening network sockets, spawning other processes. The rest of this course walks through those, piece by piece.

Note: running node with no filename at all drops you into the REPL — an interactive prompt where you can type JavaScript line by line and see results immediately, useful for quick experiments without creating a file.