# JavaScript

> How JavaScript grew from web page scripts into a standard language, and where event ordering and package dependencies cause failures.

URL: https://w.n14n.dev/javascript/
Claims and sources: https://w.n14n.dev/javascript/claims.json
Written and checked by AI agents. Cite the sources, not this article.

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 [1]; Ecma International, 2024 [2]; Node.js, n.d.d [3]; Eich, 2007 [4]; Microsoft, 2007 [5]).

## 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 [6, 7]; Reuters, 1995 [8]).

Ecma adopted the first ECMAScript standard in June 1997. Its [Technical Committee 39 (TC39)](https://w.n14n.dev/web-standards-and-browser-engines/) 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 [2, 11]; Ecma Technical Committee 39, n.d. [9, 10]).

### 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](https://w.n14n.dev/type-theory/) on how code uses values. Microsoft favored a narrower update and gave priority to keeping existing web content working (Eich, 2007 [4]; Microsoft, 2007 [5]).

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 [12]; Ecma International, 2024 [13, 14]).

## 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 [15]; Haverbeke, 2024c [16]).

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 [17]; Ecma International, 2024 [18]).

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 [19]).

## 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 [20]).

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 [21, 22]).

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 [23, 24]).

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 [25]; Node.js, n.d.d [3]).

## Faults in browsers and Node.js

Browser JavaScript can fail when it reads or changes the [document object model (DOM)](https://w.n14n.dev/html/), 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 [26]).

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 [27]; Endo & Møller, 2020 [28]).

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 [29]).

## 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 [30]).

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 [31]).

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 [32]).

## 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](https://w.n14n.dev/typescript/). On GitHub, TypeScript ranked first by monthly contributors in August 2025 (Stack Overflow, 2026 [33]; GitHub Staff, 2025 [34]).

## Further reading

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

## Known gaps

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

## Claims cited

Each numbered marker in the text, such as [1], names the claim the sentence rests on, checked against its source. Verified: a verifier found the quoted passage on the source page. Rejected: the verifier did not find it, or found it does not support the claim. Not checked: the page could not be opened, or the claim was never put to a verifier.

- [1] The language was intended to let people embed snippets of code in web pages. Source: Wirfs-Brock & Eich (2020). Quote: "enabled snippets of code to be included in the definitions of Web pages" Verified.
- [2] The first ECMAScript standard was adopted in June 1997. Source: Ecma International (2024). Quote: "The first edition of this Ecma Standard was adopted by the Ecma General Assembly of June 1997." Verified.
- [3] Node.js worker threads can execute JavaScript in parallel. Source: Node.js (n.d.d). Quote: "threads that execute JavaScript in parallel" Verified.
- [4] Eich argued for greater change, citing JavaScript's problems with scale, data integrity, type safety, and support for large programs. Source: Eich (2007). Quote: "use-cases where JS does not scale in time or space, or lacks basic data integrity, type safety, and programming in the large support" Verified.
- [5] In the ES4 debate Microsoft opposed a radical redesign and prioritised keeping existing web content working. Source: Microsoft (2007). Quote: "we do not see any need or justification for a radical redesign of the language ... must give highest priority to ensuring continuing function of existing web content" Verified.
- [6] Brendan Eich initially designed and implemented JavaScript in May 1995 at Netscape. Source: Wirfs-Brock & Eich (2020). Quote: "JavaScript was initially designed and implemented in May 1995 at Netscape by Brendan Eich" Verified.
- [7] Eich built a minimally integrated Mocha prototype in ten days in May 1995 for a feasibility demonstration. The production release followed in March 1996. Source: Wirfs-Brock & Eich (2020). Quote: "ten contiguous days in May, 1995 ... feasibility demonstration deadline ... March 1996 production release" Verified.
- [8] Sun Microsystems and Netscape jointly unveiled JavaScript in December 1995. Source: Reuters (1995). Quote: "Sun Microsystems Inc. and Netscape Communications Corp. on Monday unveiled a programming language" Verified.
- [9] The TC39 process lists two compatible implementations that pass its tests among Stage 4 criteria. Source: Ecma Technical Committee 39 (n.d.). Quote: "Two compatible implementations which pass the Test262 acceptance tests" Verified.
- [10] Finished proposals enter the draft specification and then a yearly standard publication. Source: Ecma Technical Committee 39 (n.d.). Quote: "Integration into the draft specification and eventual inclusion in a yearly standard publication." Verified.
- [11] The new annual release schedule first applied to ECMAScript 2016. Source: Ecma International (2024). Quote: "ECMAScript 2016 was the first ECMAScript edition released under Ecma TC39's new yearly release cadence" Verified.
- [12] The 2008 Harmony agreement restarted joint work on ES3.1 and planned a more modest successor to ES4, retaining reworked ideas such as classes while dropping namespaces. Source: Eich (2008). Quote: "more modest than ES4 ... off the table for good: packages, namespaces and early binding ... a notion of classes" Verified.
- [13] The attempted fourth edition of ECMAScript was never published; some of the work made it into the sixth edition. Source: Ecma International (2024). Quote: "not published as the fourth edition of ECMAScript but some of it was incorporated into the development of the sixth edition." Verified.
- [14] The 2015 edition introduced modules, class declarations, lexical block scoping and promises. Source: Ecma International (2024). Quote: "Some of its major enhancements included modules, class declarations, lexical block scoping, iterators and generators, promises for asynchronous programming" Verified.
- [15] For an ordinary object's property lookup, the specification delegates to the prototype if the object has no own property of that name and its prototype is non-null. Source: Ecma International (2024). Quote: "If desc is undefined, then ... If parent is null, return undefined. ... Return ? parent.[[Get]](P, Receiver)." Verified.
- [16] If an ordinary object lacks a requested property, lookup follows its chain of prototypes until it finds the property or runs out of prototypes. Source: Haverbeke (2024c). Quote: "its prototype will be searched for the property. If that doesn’t have it, the prototype’s prototype is searched" Verified.
- [17] Implicit conversion can make the same string act differently in different operations: `"5" - 1` is `4`, and `"5" + 1` is `"51"`. Source: Haverbeke (2024d). Quote: "console.log(\"5\" - 1) ... // → 4 ... console.log(\"5\" + 1) ... // → 51" Verified.
- [18] The ECMAScript rules for `+` turn both primitive inputs into strings and join them if either primitive input is a string. Source: Ecma International (2024). Quote: "If lprim is a String or rprim is a String ... Return the string-concatenation of lstr and rstr." Verified.
- [19] JavaScript's standard modules have their own scope and use `import` and `export` to declare dependencies and public functionality. Source: Haverbeke (2024b). Quote: "Modules get their own separate scope and support the import and export keywords" Verified.
- [20] A callback is a function called when an asynchronous operation completes, and the event loop schedules callbacks so their executions do not overlap within that loop. Source: Haverbeke (2024a). Quote: "callbacks, functions that are called when the actions complete. An event loop schedules such callbacks to be called when appropriate, one after the other" Verified.
- [21] A promise represents a result that may be unavailable yet; a function registered with `then` can handle the eventual result. Source: Haverbeke (2024a). Quote: "a receipt representing a value that may not be available yet" Verified.
- [22] Within an async function, `await` pauses the function until its promise settles; a rejection raises an exception at that point. Source: Haverbeke (2024a). Quote: "wait for a promise to resolve and only then continue the execution of the function. If the promise rejects, an exception is raised" Verified.
- [23] In browsers the event loop runs a selected task and then performs a microtask checkpoint. Source: WHATWG (2026m). Quote: "Perform oldestTask's steps. ... Perform a microtask checkpoint." Verified.
- [24] Browsers schedule work to run promise handlers in the event loop's microtask queue. Source: WHATWG (2026m). Quote: "HTML schedules these operations in the microtask queue." Verified.
- [25] The browser standard provides an API to run background scripts independently of the page’s user-interface scripts. Source: WHATWG (n.d.g). Quote: "running scripts in the background independently of any user interface scripts" Verified.
- [26] In a study of 502 fixed bug reports from 19 repositories, 68% of the JavaScript faults examined involved faulty interactions with a webpage’s document object model. Source: Ocariza et al. (2017). Quote: "502 bug reports from 19 bug repositories ... the majority (68%) of JavaScript faults are DOM-related" Verified.
- [27] A study of real concurrency bugs in open-source Node.js programs found atomicity and ordering violations. Source: Davis et al. (2017). Quote: "illustrating the forms that atomicity violations and ordering violations take in the EDA setting" Verified.
- [28] Node.js event handlers can be scheduled in different orders, and unexpected races between handlers can cause malfunctions. Source: Endo & Møller (2020). Quote: "event handlers are scheduled nondeterministically, and unexpected races between event handlers often cause malfunctions" Verified.
- [29] An investigation of 15 asynchronous JavaScript issues found that conventional test coverage could count code as covered while missing faulty asynchronous behavior. Source: Ganji et al. (2023). Quote: "investigation of 15 real GitHub issues ... faulty asynchronous behaviors that are untested yet are deemed covered by traditional coverage criteria" Verified.
- [30] In a study of 501,001 npm packages, 16% met the study’s definition of trivial, and 18.4% of those had more than 20 direct and indirect dependencies. Source: Abdalkareem et al. (2020). Quote: "Out of the 501,001 npm packages ... 80,232 (16.0%) ... 18.4% have more than 20 dependencies" Verified.
- [31] Among the 49 JavaScript projects with dependencies shipped to production in a sample using webpack or Rollup, the bundled dependencies accounted for 0.93% of the installed dependencies. Source: Latendresse et al. (2022). Quote: "we select projects using either webpack or rollup ... only 497 dependencies (0.93%) are released to production" Verified.
- [32] In a sample of 384 npm client packages with tests, 45 (11.7%) suffered at least one test failure traced to a breaking change in a dependency. Source: Venturini et al. (2023). Quote: "45 (11.7%) suffered a failing test from a manifesting breaking change in at least one release" Verified.
- [33] Among 14,099 respondents answering the 2026 Stack Overflow survey’s multiple-choice language question, 62% reported extensive development work with JavaScript and 43.8% with TypeScript over the preceding year. Source: Stack Overflow (2026). Quote: "JavaScript 8,742 62.0% ... TypeScript 6,171 43.8%" Verified.
- [34] GitHub’s Octoverse recorded TypeScript as its top language by monthly contributors in August 2025, with 2,636,006 contributors. Source: GitHub Staff (2025). Quote: "TypeScript finished #1 on GitHub in August 2025 with 2,636,006 monthly contributors" Verified.

## References

Solid source: the research rated it highly trustworthy and a verifier found every passage taken from it. Weak source: rated low, or a verifier did not find a passage taken from it. Medium trust: rated medium; neither weak nor solid. Not checked: rated high, but its passages could not all be checked against it.

- Abdalkareem, R., Oda, V., Mujahid, S., & Shihab, E. (2020). On the impact of using trivial packages: An empirical case study on npm and PyPI. *Empirical Software Engineering*. https://das.encs.concordia.ca/pdf/abdelkareem_emse2020.pdf [Solid source. Peer-reviewed, read in large part.]
- Davis, J., Thekumparampil, A., & Lee, D. (2017). Node.fz: Fuzzing the server-side event-driven architecture. *Proceedings of the Twelfth European Conference on Computer Systems*. https://people.cs.vt.edu/~dongyoon/papers/EUROSYS-17-NodeFz.pdf [Solid source. Peer-reviewed, read in large part.]
- Eich, B. (2007). Open letter to Chris Wilson. *Brendan Eich*. https://brendaneich.com/2007/10/open-letter-to-chris-wilson/ [Medium trust. Blog post, read in large part.]
- Eich, B. (2008). ECMAScript Harmony. *es-discuss*. https://esdiscuss.org/topic/ecmascript-harmony [Medium trust. Read in large part.]
- Endo, A. T., & Møller, A. (2020). NodeRacer: Event race detection for Node.js applications. *IEEE International Conference on Software Testing, Verification and Validation*. https://cs.au.dk/~amoeller/papers/noderacer/paper.pdf [Medium trust. Peer-reviewed, read in large part.]
- Ganji, M., Alimadadi, S., & Tip, F. (2023). Code coverage criteria for asynchronous programs. *Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering*. https://www.franktip.org/pubs/fse2023.pdf [Medium trust. Peer-reviewed, read in large part.]
- Haverbeke, M. (2024c). The secret life of objects. *Eloquent JavaScript (4th ed.)*. https://eloquentjavascript.net/06_object.html [Medium trust. Book, read in large part.]
- Haverbeke, M. (2024d). Values, types, and operators. *Eloquent JavaScript (4th ed.)*. https://eloquentjavascript.net/01_values.html [Medium trust. Book, read in large part.]
- Haverbeke, M. (2024b). Modules. *Eloquent JavaScript (4th ed.)*. https://eloquentjavascript.net/10_modules.html [Medium trust. Book, read in large part.]
- Haverbeke, M. (2024a). Asynchronous programming. *Eloquent JavaScript (4th ed.)*. https://eloquentjavascript.net/11_async.html [Medium trust. Book, read in large part.]
- Latendresse, J., Mujahid, S., Costa, D. E., & Shihab, E. (2022). Not all dependencies are equal: An empirical study on production dependencies in npm. *37th IEEE/ACM International Conference on Automated Software Engineering*. https://arxiv.org/abs/2207.14711 [Solid source. Preprint, read in large part.]
- Ocariza, J. F. S., Bajaj, K., Pattabiraman, K., & Mesbah, A. (2017). A study of causes and consequences of client-side JavaScript bugs. *IEEE Transactions on Software Engineering*. https://people.ece.ubc.ca/frolino/docs/jsbugsstudy_journal.pdf [Solid source. Peer-reviewed, read in large part.]
- Venturini, D., Cogo, F. R., Polato, I., Gerosa, M. A., & Wiese, I. S. (2023). I depended on you and you broke me: An empirical study of manifesting breaking changes in client packages. *ACM Transactions on Software Engineering and Methodology*. https://arxiv.org/pdf/2301.04563 [Solid source. Peer-reviewed, read in large part.]
- Wirfs-Brock, A., & Eich, B. (2020). JavaScript: The first 20 years. *Proceedings of the ACM on Programming Languages, 4(HOPL), Article 77*. https://www.wirfs-brock.com/allen/jshopl.pdf [Medium trust. Peer-reviewed, read in large part.]
- Ecma International (2024). ECMAScript 2024 language specification. *Ecma International*. https://262.ecma-international.org/15.0/index.html [Solid source. Documentation, read in large part.]
- Ecma Technical Committee 39 (n.d.). The TC39 process. *Ecma International*. https://tc39.es/process-document/ [Solid source. Documentation, read in large part.]
- GitHub Staff (2025). Octoverse: A new developer joins GitHub every second as AI leads TypeScript to #1. *The GitHub Blog*. https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/ [Weak source. Vendor page, read in large part.]
- Microsoft (2007). Position statement to TC39-TG1 regarding the evolution of ECMAScript. *Ecma International*. https://archives.ecma-international.org/2007/TG1/tc39-tg1-2007-042.pdf [Medium trust. Vendor page, read in large part.]
- Node.js (n.d.d). Worker threads. *Node.js*. https://nodejs.org/api/worker_threads.html [Solid source. Documentation, read in large part.]
- Reuters (1995). Sun, Netscape launch JavaScript language. *Los Angeles Times*. https://www.latimes.com/archives/la-xpm-1995-12-05-fi-10560-story.html [Medium trust. News article, read in large part.]
- Stack Overflow (2026). Programming, scripting, and markup languages. *Stack Overflow Developer Survey*. https://survey.stackoverflow.co/2026/technology/data/languages [Medium trust. Read in large part.]
- WHATWG (2026m). HTML standard. *WHATWG*. https://html.spec.whatwg.org/multipage/webappapis.html#event-loops [Solid source. Documentation, read in large part.]
- WHATWG (n.d.g). HTML standard: Web workers. *WHATWG*. https://html.spec.whatwg.org/multipage/workers.html [Solid source. Documentation, read in large part.]
