JavaScript

Hand-drawn oval terracotta loop of small blocks with a short line of blocks joining it from the left, over sand, umber and moss herringbone hatching.

JavaScript is a programming language created to run snippets of code in web pages. Its language rules are standardized as ECMAScript, and it also runs outside browsers in environments such as Node.js. A major design debate concerned how far to change the language to support larger programs while keeping existing web pages working (Wirfs-Brock & Eich, 2020; Ecma International, 2024; Node.js, n.d.d; Eich, 2007; Microsoft, 2007).

Origins and standardization

Brendan Eich designed and first implemented JavaScript at Netscape in May 1995. He spent ten days on the prototype to demonstrate that the idea could work. Netscape and Sun Microsystems unveiled JavaScript in December 1995. The production release followed with Netscape Navigator 2.0 in March 1996 (Wirfs-Brock & Eich, 2020; Reuters, 1995).

Ecma adopted the first ECMAScript standard in June 1997. Its Technical Committee 39 (TC39) takes changes from proposals to finished specifications. One requirement at the final stage is that two compatible implementations pass the acceptance tests. Finished proposals enter the draft, then a yearly edition. The annual schedule began with the 2016 edition (Ecma International, 2024; Ecma Technical Committee 39, n.d.).

The fourth edition debate

The proposed fourth edition (ES4) divided participants over the size and purpose of the revision. Eich argued that JavaScript needed better support for larger programs and stronger checks on how code uses values. Microsoft favored a narrower update and gave priority to keeping existing web content working (Eich, 2007; Microsoft, 2007).

In 2008 the committee agreed to finish a narrower revision first and pursue a more modest successor. The agreement set aside proposals such as namespaces, which group names to keep them distinct, and kept a revised plan for classes. ES4 went unpublished. Some of its work entered the sixth edition, published in 2015, whose additions included classes, modules and promises (Eich, 2008; Ecma International, 2024).

Objects, conversions and modules

Ordinary JavaScript objects can inherit properties from other objects. A property is a named part of an object, such as the title of a menu. When an object has no property of its own by that name, JavaScript looks in a linked object called its prototype. The lookup follows successive prototypes until it finds a match or runs out of objects to check (Ecma International, 2024; Haverbeke, 2024c).

Operators can convert values automatically, a rule known as coercion. For example, "5" - 1 produces the number 4 because subtraction converts the text to a number. In "5" + 1, the plus sign converts the number to text and joins the two strings, producing "51" (Haverbeke, 2024d; Ecma International, 2024).

A module gives a unit of code its own scope, the area where its names are visible. It uses export to make selected names available and import to use names supplied by other modules (Haverbeke, 2024b).

How asynchronous code runs

Asynchronous code can start an operation and handle its result later. A callback is a function that can run when such an operation finishes. An event loop schedules these functions so they run one at a time within that loop (Haverbeke, 2024a).

A promise represents a result that may still be pending. Code can register a function with then to handle the result when it becomes available. Inside an async function, await pauses that function until the promise succeeds or fails. If the promise fails, await raises an exception at that point (Haverbeke, 2024a).

In browsers, the event loop runs a selected task and then processes its microtasks, the work scheduled to run at that checkpoint. Promise handlers go into the microtask queue, so a handler queued by the current task can run before the next task (WHATWG, 2026m).

Browsers provide web workers, which run scripts independently of scripts that handle the interface. Node.js provides worker threads that can execute JavaScript in parallel (WHATWG, n.d.g; Node.js, n.d.d).

Faults in browsers and Node.js

Browser JavaScript can fail when it reads or changes the document object model (DOM), the browser’s representation of a page that code can access. In a study of 502 fixed bug reports from 19 repositories, 68% of the JavaScript faults examined involved the DOM (Ocariza et al., 2017).

In Node.js, a race can occur when a program’s result depends on the order in which event handlers run. A handler is a function that responds to an event, such as the completion of a request. A study of open-source Node.js programs found faults caused by unexpected handler order, including cases where another handler ran between steps meant to act as a unit (Davis et al., 2017; Endo & Møller, 2020).

Tests can execute the relevant lines of code and still miss a faulty order of events. An investigation of 15 asynchronous issues found that ordinary test coverage could count code as covered even when tests missed its faulty asynchronous behavior (Ganji et al., 2023).

npm dependencies

Even small packages in npm, a registry of reusable software packages, can depend on many other packages. A package’s dependencies include the ones it uses directly and the ones those packages require in turn. In a study of 501,001 npm packages, 16% met the study’s definition of a small, simple package. Of that group, 18.4% had more than 20 direct and indirect dependencies (Abdalkareem et al., 2020).

The code shipped to users can include only a fraction of a project’s installed packages. In 49 projects that shipped dependencies using webpack or Rollup, the production bundles included 497 of 53,421 installed dependencies, about 0.9% (Latendresse et al., 2022).

A dependency update can cause a package’s own tests to fail. Among 384 npm packages with usable tests, 45 (11.7%) had at least one test failure traced to a breaking change in a dependency (Venturini et al., 2023).

Use in surveys and on GitHub

Developer surveys and repository activity measure different populations. Among the 14,099 people who answered Stack Overflow’s 2026 language question, 62% reported extensive work in JavaScript over the past year. The question allowed multiple choices, and 43.8% reported TypeScript. On GitHub, TypeScript ranked first by monthly contributors in August 2025 (Stack Overflow, 2026; GitHub Staff, 2025).

Further reading

  • Wirfs-Brock and Eich trace JavaScript from the Netscape prototype through its first two decades of standardization (Wirfs-Brock & Eich, 2020).
  • Haverbeke explains callbacks, promises and asynchronous functions with examples (Haverbeke, 2024a).
  • Latendresse and colleagues measure how many installed npm dependencies end up in production bundles (Latendresse et al., 2022).

Known gaps

What this article cannot tell you yet.

  1. The share of JavaScript faults caused by asynchronous ordering across projects remains unclear.
  2. How much installed npm code reaches production with other build tools and in server deployments remains unclear.
  3. The adoption figures cover one developer survey and one measure of GitHub activity. Worldwide use remains outside their scope.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 23 references