What is Node.js?
- Node.js course
- Beginner
- Lesson 1/116
- 4 min
Learn that Node.js is a V8-based runtime and the event loop.
What is Node.js?
Node.js is a runtime that runs JavaScript outside the browser. It is used to write server applications, command-line tools and scripts.
It is built on Google Chrome's V8 engine and uses the libuv library to perform file and network operations asynchronously. This way it can handle thousands of connections at once efficiently.
Today Node.js 22 LTS is the recommended version. This course uses ES modules syntax.
V8 and the event loop
V8 is Google's open-source JavaScript engine. It is written in C++ and compiles JavaScript into machine code. Node.js uses V8 to execute JavaScript quickly.
The event loop enables Node.js to work asynchronously. When an operation finishes, a callback is triggered. This way the main flow can do other work without blocking.
This model provides high throughput, especially for network and database operations.
Practice Write your first output
Use console.log to print Node.js is running to the screen.
Starter code
// Write your message hereSample solution
console.log("Node.js is running");Expected output
Node.js is running
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is Node.js built on?
- The C# runtime
- The Python interpreter
- The Java virtual machine
- The V8 JavaScript engine Correct answer
Explanation: Node.js is built on the V8 engine.
2 Match the concepts
| Term | Meaning |
|---|---|
Node.js |
Runtime |
V8 |
JavaScript engine |
libuv |
Event loop library |
npm |
Package manager |
3 Run command
To run a JavaScript file, you type ____ file.js in the terminal.
To run a JavaScript file, you type node file.js in the terminal.
Explanation: The node command runs a JavaScript file.