JavaScript technologies overview

Whereas HTML defines a webpage's structure and content and CSS sets the formatting and appearance, JavaScript adds interactivity to a webpage and creates rich web applications.

However, the umbrella term "JavaScript" as understood in a web browser context contains several very different elements. One of them is the core language (ECMAScript), another is the collection of the Web APIs, including the DOM (Document Object Model).

JavaScript, the core language (ECMAScript)

The core language of JavaScript is standardized by the ECMA TC39 committee as a language named ECMAScript. "ECMAScript" is the term for the language standard, but "ECMAScript" and "JavaScript" can be used interchangeably.

This core language is also used in non-browser environments, for example in Node.js.

What falls under the ECMAScript scope?

Among other things, ECMAScript defines:

  • Language syntax (parsing rules, keywords, control flow, object literal initialization, ...)
  • Error handling mechanisms (throw, try...catch, ability to create user-defined Error types)
  • Types (boolean, number, string, function, object, ...)
  • A prototype-based inheritance mechanism
  • Built-in objects and functions, including JSON, Math, Array methods, parseInt, decodeURI, etc.
  • Strict mode
  • A module system
  • Basic memory model

Standardization process

ECMAScript editions are approved and published as a standard by the ECMA General Assembly on a yearly basis. All development is public on the Ecma TC39 GitHub organization, which hosts proposals, the official specification text, and meeting notes.

Before the 6th edition of ECMAScript (known as ES6), specifications were published once every several years, and are commonly referred by their major version numbers — ES3, ES5, etc. After ES6, the specification is named by the publishing year — ES2017, ES2018, etc. ES6 is synonymous with ES2015. ESNext is a dynamic name that refers to whatever the next version is at the time of writing. ESNext features are more correctly called proposals, because, by definition, the specification has not been finalized yet.

The current committee-approved snapshot of ECMA-262 is available in PDF and HTML format on Ecma International's ECMA-262 language specification page. ECMA-262 and ECMA-402 are continuously maintained and kept up to date by the specification editors; the TC39 website hosts the latest, up-to-date ECMA-262 and ECMA-402 versions.

New language features, including introduction of new syntaxes and APIs and revision of existing behaviors, are discussed in the form of proposals. Each proposal goes through a 4-stage process, and is typically implemented by JavaScript engines at stage 3 or stage 4 and thus available for public consumption.

See Wikipedia ECMAScript entry for more information on ECMAScript history.

Internationalization API

The ECMAScript Internationalization API Specification is an addition to the ECMAScript Language Specification, also standardized by Ecma TC39. The internationalization API provides collation (string comparison), number formatting, and date-and-time formatting for JavaScript applications, letting the applications choose the language and tailor the functionality to their needs. The initial standard was approved in December 2012; the status of implementations in browsers is tracked in the documentation of the Intl object. The Internationalization specification is nowadays also ratified on a yearly basis and browsers constantly improve their implementation.

There are a variety of ways you can participate in or just track current work on the ECMAScript Language Specification and the ECMAScript Internationalization API Specification and related resources:

DOM APIs

WebIDL

The WebIDL specification provides the glue between the DOM technologies and ECMAScript.

The Core of the DOM

The Document Object Model (DOM) is a cross-platform, language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. Objects in the DOM tree may be addressed and manipulated by using methods on the objects. The W3C standardizes the Core Document Object Model, which defines language-agnostic interfaces that abstract HTML and XML documents as objects, and also defines mechanisms to manipulate this abstraction. Among the things defined by the DOM, we can find:

From the ECMAScript point of view, objects defined in the DOM specification are called "host objects".

HTML DOM

HTML, the Web's markup language, is specified in terms of the DOM. Layered above the abstract concepts defined in DOM Core, HTML also defines the meaning of elements. The HTML DOM includes such things as the className property on HTML elements, or APIs such as document.body.

The HTML specification also defines restrictions on documents; for example, it requires all children of a <ul> element, which represents an unordered list, to be <li> elements, as those represent list items. In general, it also forbids using elements and attributes that aren't defined in a standard.

Looking for the Document object, Window object, and the other DOM elements? Read the DOM documentation.

Other notable APIs

Non-browser environments (like Node.js) often do not have DOM APIs — because they don't interact with a document — but they still usually implement many web APIs, such as fetch() and setTimeout().

JavaScript implementations

There are three main JavaScript implementations used in browser environments and beyond:

  • Mozilla's SpiderMonkey, used in Firefox. This was the first ever JavaScript engine, created by Brendan Eich at Netscape.
  • Google's V8, used in Google Chrome, Opera, Edge, Node.js, Deno, Electron, and more.
  • Apple's JavaScriptCore (also known as SquirrelFish/Nitro), used in WebKit browsers such as Apple Safari, and Bun.

Besides the above implementations, there are other popular JavaScript engines such as:

  • Carakan, used in earlier versions of Opera.
  • Microsoft's Chakra engine, used in Internet Explorer (although the language it implements is formally called "JScript" to avoid trademark issues). Earlier versions of Edge used a new JavaScript engine, confusingly also called Chakra.
  • LibJS, used in the browser implementation of SerenityOS.
  • Mozilla's Rhino engine, a JavaScript implementation written in Java, created primarily by Norris Boyd (also at Netscape).

There are some engines specifically tailored for non-browser purposes:

  • Engine262, a JavaScript engine written in JavaScript. It is created for JavaScript developers to explore new language features and find bugs in the specification.
  • Moddable XS, used in embedded systems such as IoT.
  • QuickJS, a small and embeddable JavaScript engine.
  • Meta's Hermes engine, an engine optimized for React Native.
  • Oracle's GraalJS, a high performance implementation built on the GraalVM by Oracle Labs.

JavaScript engines expose a public API which application developers can use to integrate JavaScript into their software. By far, the most common host environment for JavaScript is web browsers. Web browsers typically use the public API to create host objects responsible for reflecting the DOM into JavaScript.

Another common application for JavaScript is as a (Web) server-side scripting language. A JavaScript web server exposes host objects representing a HTTP request and response objects, which can then be manipulated by a JavaScript program to dynamically generate web pages. Node.js is a popular example of this.

Shells

A JavaScript shell allows you to quickly test snippets of JavaScript code without having to reload a web page. They are extremely useful for developing and debugging code.

Standalone JavaScript shells

The following JavaScript shells are stand-alone environments, like Perl or Python.

  • Node.js - Node.js is a platform for easily building fast, scalable network applications.
  • ShellJS - Portable Unix shell commands for Node.js.

Browser-based JavaScript shells

The following JavaScript shells run code through the browser's JavaScript engine.

Tools & resources

Helpful tools for writing and debugging your JavaScript code.

Firefox Developer Tools

Web Console, JavaScript Profiler, Debugger, and more.

Learn JavaScript

An excellent resource for aspiring web developers — Learn JavaScript in an interactive environment, with short lessons and interactive tests, guided by automated assessment. The first 40 lessons are free, and the complete course is available for a small one-time payment.

TogetherJS

Collaboration made easy. By adding TogetherJS to your site, your users can help each other out on a website in real-time!

Stack Overflow

Stack Overflow questions tagged with "JavaScript".

JSFiddle

Edit JavaScript, CSS, and HTML and get live results. Use external resources and collaborate with your team online.

Plunker

Plunker is an online community for creating, collaborating on, and sharing your web development ideas. Edit your JavaScript, CSS, and HTML files and get live results and file structure.

JSBin

JS Bin is an open-source collaborative web development debugging tool.

Codepen

Codepen is another collaborative web development tool used as a live result playground.

StackBlitz

StackBlitz is another online playground/debugging tool, which can host and deploy full-stack applications using React, Angular, etc.

RunJS

RunJS is a desktop playground/scratchpad tool, which provides live results and access to both Node and Browser APIs.