ECMAScript (; ES) is a
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
standard intended to ensure the
interoperability
Interoperability is a characteristic of a product or system to work with other products or systems. While the term was initially defined for information technology or systems engineering services to allow for information exchange, a broader defi ...
of
web pages across different
browsers. It is standardized by
Ecma International
Ecma International () is a nonprofit standards organization for information and communication systems. It acquired its current name in 1994, when the European Computer Manufacturers Association (ECMA) changed its name to reflect the organizatio ...
in the documen
ECMA-262
ECMAScript is commonly used for
client-side scripting
A server-side dynamic web page is a web page whose construction is controlled by an application server processing server-side scripts. In server-side scripting, parameters determine how the assembly of every new web page proceeds, and includi ...
on the
World Wide Web
The World Wide Web (WWW), commonly known as the Web, is an information system enabling documents and other web resources to be accessed over the Internet.
Documents and downloadable media are made available to the network through web se ...
, and it is increasingly being used for writing server-side applications and services using
Node.js
Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript code ou ...
and other runtime environments.
ECMAScript, ECMA-262 and JavaScript
ECMA-262, or the ''ECMAScript Language Specification'', defines the ''ECMAScript Language'', or just ECMAScript. ECMA-262 specifies only language syntax and the semantics of the core
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
, such as , , and , while valid implementations of JavaScript add their own functionality such as input-output and file-system handling.
History
The ECMAScript specification is a standardized specification of a scripting language developed by
Brendan Eich
Brendan Eich (; born July 4, 1961) is an American computer programmer and technology executive. He created the JavaScript programming language and co-founded the Mozilla project, the Mozilla Foundation, and the Mozilla Corporation. He served as ...
of
Netscape
Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California and then Dulles, Virginia. Its Netscape web browser was onc ...
; initially named Mocha, then LiveScript, and finally JavaScript. In December 1995,
Sun Microsystems
Sun Microsystems, Inc. (Sun for short) was an American technology company that sold computers, computer components, software, and information technology services and created the Java programming language, the Solaris operating system, ZFS, the ...
and Netscape announced JavaScript in a press release. In November 1996, Netscape announced a meeting of the
Ecma International
Ecma International () is a nonprofit standards organization for information and communication systems. It acquired its current name in 1994, when the European Computer Manufacturers Association (ECMA) changed its name to reflect the organizatio ...
standards organization to advance the standardization of JavaScript. The first edition of ECMA-262 was adopted by the Ecma General Assembly in June 1997. Several editions of the language standard have been published since then. The name "ECMAScript" was a compromise between the organizations involved in standardizing the language, especially Netscape and Microsoft, whose disputes dominated the early standards sessions. Eich commented that "ECMAScript was always an unwanted trade name that sounds like a
skin disease
A skin condition, also known as cutaneous condition, is any medical condition that affects the integumentary system—the organ system that encloses the body and includes skin, nails, and related muscle and glands. The major function of this sy ...
." ECMAScript has been formalized through
operational semantics
Operational semantics is a category of formal programming language semantics in which certain desired properties of a program, such as correctness, safety or security, are verified by constructing proofs from logical statements about its execu ...
by work at
Stanford University
Stanford University, officially Leland Stanford Junior University, is a private research university in Stanford, California. The campus occupies , among the largest in the United States, and enrolls over 17,000 students. Stanford is consider ...
and the
Department of Computing,
Imperial College London
Imperial College London (legally Imperial College of Science, Technology and Medicine) is a public research university in London, United Kingdom. Its history began with Prince Albert, consort of Queen Victoria, who developed his vision for a cu ...
for security analysis and standardization.
Version history
Features
The ECMAScript language includes
structured,
dynamic
Dynamics (from Greek δυναμικός ''dynamikos'' "powerful", from δύναμις ''dynamis'' "power") or dynamic may refer to:
Physics and engineering
* Dynamics (mechanics)
** Aerodynamics, the study of the motion of air
** Analytical dynam ...
,
functional
Functional may refer to:
* Movements in architecture:
** Functionalism (architecture)
** Form follows function
* Functional group, combination of atoms within molecules
* Medical conditions without currently visible organic basis:
** Functional sy ...
, and
prototype-based features.
Imperative and structured
ECMAScript JavaScript supports
C style structured programming. Previously, JavaScript only supported
function scoping using the keyword
var
, but ECMAScript 2015 added the keywords
let
and
const
allowing JavaScript to support both block scoping and function scoping. JavaScript supports
automatic semicolon insertion, meaning that semicolons that are normally used to terminate a statement in C may be omitted in JavaScript.
Like C-style languages,
control flow
In computer science, control flow (or flow of control) is the order in which individual statements, instructions or function calls of an imperative program are executed or evaluated. The emphasis on explicit control flow distinguishes an ''imper ...
is done with the , , / , / , and statements. Functions are weakly typed and may accept and return any type. Arguments not provided default to .
Weakly typed
ECMAScript is
weakly typed. This means that certain types are assigned implicitly based on the operation being performed. However, there are several quirks in JavaScript's implementation of the conversion of a variable from one type to another. These quirks have been the subject of a talk entitled ''Wat''.
Dynamic
ECMAScript is dynamically typed. Thus, a type is associated with a value rather than an expression. ECMAScript supports various ways to test the type of objects, including
duck typing.
Transpiling
Since ES 2015, transpiling JavaScript has become very common. Transpilation is a
source-to-source compilation
A source-to-source translator, source-to-source compiler (S2S compiler), transcompiler, or transpiler is a type of translator (computing), translator that takes the source code of a program written in a programming language as its input and pr ...
in which newer versions of JavaScript are used, and a transpiler rewrites the source code so that it is supported by older browsers. Usually, transpilers transpile down to ES3 to maintain compatibility with all versions of browsers. The settings to transpiling to a specific version can be configured according to need. Transpiling adds an extra step to the build process and is sometimes done to avoid needing
polyfills. Polyfills create new features for older environments that lack them. Polyfills do this at runtime in the interpreter, such as the user's browser or on the server. Instead, transpiling rewrites the ECMA code itself during the build phase of development before it reaches the interpreter.
Conformance
In 2010, Ecma International started developing a standards test for Ecma 262 ECMAScript.
Test262 is an ECMAScript conformance test suite that can be used to check how closely a JavaScript implementation follows the ECMAScript Specification. The test suite contains thousands of individual tests, each of which tests some specific requirement(s) of the ECMAScript specification. The development of Test262 is a project of the Ecma Technical Committee 39 (TC39). The testing framework and individual tests are created by member organizations of TC39 and contributed to Ecma for use in Test262.
Important contributions were made by Google (Sputnik testsuite) and Microsoft who both contributed thousands of tests.
The Test262 testsuite consisted of tests .
ECMAScript specifications through ES7 are well-supported in major
web browser
A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used on ...
s. The table below shows the conformance rate for current versions of software with respect to the most recent editions of ECMAScript.
See also
*
ECMAScript for XML ECMAScript for XML (E4X) is the standarprogramming language extension that adds native XML support to ECMAScript (which includes ActionScript, JavaScript, and JScript). The goal is to provide an alternative to DOM interfaces that uses a simpler synt ...
(E4X)
*
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
*
JScript
JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer 11 and older.
JScript is implemented as an Active Scripting engine. This means that it can be "plugged in" to OLE Automation applicati ...
*
List of ECMAScript engines
An ECMAScript engine is a program that executes source code written in a version of the ECMAScript language standard, for example, JavaScript.
Just-in-time compilation engines
These are new generation ECMAScript engines for web browsers, all im ...
References
{{List of International Electrotechnical Commission standards
Computer-related introductions in 1997
C programming language family
Computer standards
Dynamically typed programming languages
Ecma standards
JavaScript dialect engines
JavaScript programming language family
Object-based programming languages
Programming languages with an ISO standard
Prototype-based programming languages
Scripting languages
Source-to-source compilers