Glossary / ECMAScript

ECMAScript

ECMAScript is the standardized programming language specification commonly implemented as JavaScript. It defines the grammar, value types, operators, functions, objects, modules, and built-in algorithms that engines must follow. Browsers, Node.js, and other hosts add APIs of their own, so knowing whether a behavior comes from ECMAScript or its host environment is essential when debugging portability issues.

The language specification and implementations

The ECMAScript Language Specification (ECMA-262) is normative: it describes required behavior, often in detail through abstract operations and internal methods. An engine such as V8, SpiderMonkey, or JavaScriptCore implements those requirements and adds host integration. For example, Promise, Map, and the language-level Date object are ECMAScript built-ins; document, the DOM event model, fetch, and setTimeout are host APIs specified elsewhere or by host vendors/standards.

The TC39 committee maintains the language. Proposals move through stages of review; a proposal is not automatically safe to use merely because it is discussed or implemented experimentally. Once standardized, deployment still depends on the versions of engines and tools in the application’s support matrix. Transpilers may rewrite syntax, but cannot necessarily polyfill a missing engine capability or reproduce every semantic detail.

How to reason from the spec

When behavior is surprising, isolate the language operation: parsing, reference resolution, primitive conversion, property lookup, function call, promise job, or serialization. Search the relevant specification algorithm and compare it with a readable reference. The spec distinguishes syntax errors (rejected before execution), runtime exceptions, and normal completion values. Its pseudocode uses internal names such as [[Prototype]]; these are specification concepts, not JavaScript properties you can directly read.

Example: language versus host

const total = 0.1 + 0.2; // ECMAScript Number arithmetic
const node = document.querySelector("main"); // DOM host API

The floating-point result follows ECMAScript Number semantics. Whether document exists depends on the host; this code fails in a typical Node.js process unless a DOM implementation is supplied.

Practical guidance

Interview questions

  1. What does ECMAScript specify? JavaScript’s core syntax, semantics, and built-ins; it does not specify every browser or Node API.
  2. Is JavaScript the same thing as ECMAScript? JavaScript is the language name and ecosystem; ECMAScript is its standardized core specification, with hosts adding APIs.
  3. What is the difference between a syntax error and runtime error? A syntax error prevents the source unit from being parsed; a runtime error occurs while executing valid parsed code.
  4. How would you investigate a disputed edge case? Reproduce it in target engines, identify which host/language layer is involved, and consult the applicable normative specification and compatibility information.

References