JavaScript theorytheory 0/50 · 0%
Foundations · easy

1. What JavaScript runs on

Engines, the browser and Node.js.

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.

Check your understanding

  1. 1. Which object is browser-only?

  2. 2. Which engine powers Node.js?

  3. 3. What is `fetch` part of?