Back to List

What is Node.js β€” The Concept of Runtime

Understand what Node.js is and what a runtime is in 5 minutes. How to run JavaScript outside the browser.

Beginner
|
5min
|
Verified (2026-07)
Progress0/55 (0%)

What is Node.js β€” The Concept of a Runtime

After Completing This Topic

You will be able to answer the question, "What is a runtime?" and install Node.js to run JavaScript files directly in your terminal.


What is a Runtime?

JavaScript was originally designed to run only within web browsers. To create servers, read files, or connect to databases, separate languages like Python or Java were required.

A runtime refers to the environment that enables a specific language to be executed.

  • Browser (Chrome, Safari) = The first JavaScript runtime
  • Node.js = The second JavaScript runtime (runs directly on your computer)

If you haven't installed Node.js, you won't be able to run .js files in your terminal. The moment you install Node.js, your computer gains the ability to understand and execute JavaScript.

javascript
// hello.js β€” Run in the terminal with `node hello.js`
const message = "Running with Node.js";
console.log(message);
console.log(`Current time: ${new Date().toLocaleTimeString()}`);

You can execute this by typing node hello.js in your terminal. No HTML file is needed.

Browser vs. Node.js

Even though it's the same JavaScript, the tasks you can perform depend on the execution environment.

BrowserNode.js
Execution LocationInside a web pageYour computer's terminal
CapabilitiesManipulating the screen, handling button eventsReading files, creating servers, connecting to databases
Execution CommandPlace <script> in HTMLnode filename.js

Thanks to Node.js, you can now create both the front-end (screen) and back-end (server) using just JavaScript. This is why the term "full-stack" has become a reality in the JavaScript world.

bash
# Check if Node.js is installed
node --version
# If a version like `v22.x.x` is displayed, it's installed
# Run a JavaScript file
node hello.js

β†’ Apply to Bio: DevBench β€” HTML & CSS Basics

πŸ’¬ Questions & Comments

0 comments

You can post without signing in. Guest comments cannot be edited or deleted by their author.

0/2000

Loading...