A JavaScript runtime is the environment that executes JavaScript and connects it to its host platform. It includes an engine that turns code into machine instructions and API bindings that let code use host features. section 1.1.1
The host environment determines which capabilities are available:
- Browsers provide APIs for network requests, user events, and DOM updates. section 1.1.1
- Node.js provides APIs for TCP sockets, disk logging, and subprocesses. section 1.1.1
- Runtimes use different engines: V8 powers Chrome and Node.js; JavaScriptCore powers Safari and Bun. section 1.1.1
Code may target one runtime or many. Libraries such as Lodash are used across browsers, servers, and apps, while tools such as jsdom can simulate a browser-like environment in Node.js. Runtime differences matter because feature support varies. section 1.1.1 section 1.1.2
Supporting newer JavaScript features
When a target runtime lacks a feature, transpilation can transform syntax to an older ECMAScript standard, while a polyfill can supply a missing feature. Neither guarantees support for every feature: unsupported regex lookbehind, for example, can still fail. Check target runtimes and test against them. section 1.1.3
Figure 1.1 How a JavaScript runtime brings JavaScript code to life.
Use the figure to visualize how a runtime brings JavaScript code to execution. section 1.1.1





