New! Explore our Programming Academy and AI Tutor - learn to code from scratch, free to start. Explore Now
Programming› Node.js› What Node.js Is

What Node.js Is

💻 Node.js

Understand how Node runs JavaScript outside the browser and why non-blocking I/O matters.

Lesson 1 of 9 Tutorial
0 of 9 completed

Node.js is a JavaScript runtime built on Chrome's V8 engine. It runs your code on a server, a laptop or a small device, without a browser.

By the end of this lesson you can:
  • Explain the event loop.
  • Run a script with node.
  • Describe blocking versus non-blocking work.

Run a Script

Install Node from nodejs.org, then run any JavaScript file directly.

node --version
node app.js

The Event Loop

Node runs JavaScript on one thread. Slow work such as file or network access is handed to the system and resumed later through callbacks. This is why a single Node process can handle many connections.

Blocking vs Non-Blocking

A heavy loop blocks everything else. Reading a file asynchronously frees the process to handle other requests while it waits.

import { readFile } from "node:fs/promises";

// Non-blocking: other work can run while this waits
const text = await readFile("notes.txt", "utf8");
console.log(text);
Warning One slow synchronous task blocks every request. Keep CPU-heavy work out of the main process or move it to a worker.

Practice

  1. Run node --version and print the result.
  2. Write a script that prints the current time.
  3. Explain why a long loop is dangerous in a web server.

Hands-on exercise

Create app.js that:
1. Prints 'Node is running'.
2. Prints the current year using new Date().getFullYear().
3. Run it with node app.js.

Recap

Node runs JavaScript outside the browser. Non-blocking I/O and the event loop let one process serve many clients.

Example

node --version
node app.js

Exercises

Exercise 1. Hello from Node Easy
Create app.js that:
1. Prints 'Node is running'.
2. Prints the current year using new Date().getFullYear().
3. Run it with node app.js.
Node.js exercise-1.txt
Expected Output
Node is running
2026

Lesson Nav

Lesson sections