JavaScript is executed by an engine such as V8 (Chrome, Node.js, Bun) or JavaScriptCore (Safari). The language itself is small; most of what you use — the DOM, `fetch`, `window` — comes from the host environment.
That is why the same file can behave differently in a browser and in Node: `document` exists only in the browser, and `process` and `fs` only on the server.
console.log(typeof window); // "object" in a browser, "undefined" in Node
In Web3 work you write both: browser code that talks to a wallet, and Node code that talks to an RPC endpoint.