Skip to content

JavaScript Tutorial Getting Started

Browser, Node.js and Other Environments

Lesson 9 of 258 2 min read By Deepak Paswan Updated Oct 4, 2026

The language is the same everywhere. What changes is what the runtime gives you around it.

The browser

In a browser, JavaScript gets the page and everything around it: document, window, events, fetch, localStorage, the screen, the URL. There is no file system and no access to the operating system.

Node.js

Node.js is a runtime that lets you run JavaScript outside a browser, on your computer or a server. It uses the same V8 engine as Chrome, but instead of the page it gives you tools such as reading files, running a web server and talking to databases.

terminal
BASH
node hello.js
hello.js
JS
console.log("Hello from Node.js");

There is no document in Node.js, because there is no page. And fs (file system) does not exist in the browser. The language works the same; the extra tools are different.

BrowserNode.js
Page and DOMYesNo
fetchYesYes (modern versions)
Read files on diskNoYes
Typical useInterfaces on web pagesServers, command-line tools, build tools

npm and packages

Node.js comes with npm (Node Package Manager), a tool and online registry of reusable code called packages. Front-end projects use it too: tools that bundle and build your JavaScript for the browser are installed with npm. You do not need it to start learning.

Other places JavaScript runs

Other runtimes exist, such as Deno and Bun, and JavaScript also runs inside apps, desktop programs and some devices. The idea is always the same: an engine plus tools around it.

info
About this course
It is focused on browser JavaScript, because that is where most people start and where HTML and CSS meet it. Node.js is introduced only enough to explain what a runtime is. Server-side JavaScript deserves its own course.