A JavaScript engine is a
software component that executes
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 ...
code. The first JavaScript
engines were mere
interpreters, but all relevant modern engines use
just-in-time compilation
In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compiler, compilation during execution of a program (at run time (program lifecycle phase), run tim ...
for improved performance.
JavaScript engines are typically developed by
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 ...
vendors, and every major browser has one. In a browser, the JavaScript engine runs in concert with the
rendering engine via the
Document Object Model
The Document Object Model (DOM) is a cross-platform and language-independent interface that treats an XML or HTML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a docum ...
.
The use of JavaScript engines is not limited to browsers. For example, the
V8 engine
A V8 engine is an eight- cylinder piston engine in which two banks of four cylinders share a common crankshaft and are arranged in a V configuration.
The first V8 engine was produced by the French Antoinette company in 1904, developed and u ...
is a core component of the
Node.js and
Deno runtime systems.
Since
ECMAScript is the standardized specification of JavaScript, ECMAScript engine is another name for these engines. With the advent of
WebAssembly, some engines can also execute this code in the same
sandbox as regular JavaScript code.
History
The first JavaScript engine was created by
Brendan Eich in 1995 for the
Netscape Navigator 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 ...
. It was a rudimentary
interpreter for the nascent language Eich invented. (This evolved into the
SpiderMonkey engine, still used by the
Firefox browser.)
The first modern JavaScript engine was
V8, created by
Google
Google LLC () is an American Multinational corporation, multinational technology company focusing on Search Engine, search engine technology, online advertising, cloud computing, software, computer software, quantum computing, e-commerce, ar ...
for its
Chrome
Chrome may refer to:
Materials
* Chrome plating, a process of surfacing with chromium
* Chrome alum, a chemical used in mordanting and photographic film
Computing
* Google Chrome, a web browser developed by Google
** ChromeOS, a Google Chrome- ...
browser. V8 debuted as part of Chrome in 2008, and its performance was much better than any prior engine. The key innovation was
just-in-time compilation
In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compiler, compilation during execution of a program (at run time (program lifecycle phase), run tim ...
, which can significantly improve execution times.
Other browser vendors needed to overhaul their interpreters to compete.
Apple
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ances ...
developed the
Nitro engine for its
Safari browser, which had 30% better performance than its predecessor.
Mozilla leveraged portions of Nitro to improve its own SpiderMonkey engine.
Since 2017, these engines have added support for
WebAssembly. This enables the use of pre-compiled
executables for performance-critical portions of page scripts.
Notable engines
*
V8 from
Google
Google LLC () is an American Multinational corporation, multinational technology company focusing on Search Engine, search engine technology, online advertising, cloud computing, software, computer software, quantum computing, e-commerce, ar ...
is the most used JavaScript engine.
Google Chrome and the many other
Chromium
Chromium is a chemical element with the symbol Cr and atomic number 24. It is the first element in group 6. It is a steely-grey, lustrous, hard, and brittle transition metal.
Chromium metal is valued for its high corrosion resistance and h ...
-based browsers use it, as do
applications built with
CEF,
Electron
The electron (, or in nuclear reactions) is a subatomic particle with a negative one elementary electric charge. Electrons belong to the first generation of the lepton particle family,
and are generally thought to be elementary partic ...
, or any other
framework that embeds Chromium. Other uses include the
Node.js and
Deno runtime systems.
*
SpiderMonkey is developed by
Mozilla for use in
Firefox and its
forks. The
GNOME Shell uses it for extension support.
*
JavaScriptCore is
Apple
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ances ...
's engine for its
Safari browser. Other
WebKit-based browsers also use it.
KJS from KDE was the starting point for its development.
*
Chakra
Chakras (, ; sa , text=चक्र , translit=cakra , translit-std=IAST , lit=wheel, circle; pi, cakka) are various focal points used in a variety of ancient meditation practices, collectively denominated as Tantra, or the esoteric or ...
is the engine of the
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated IE or MSIE) is a series of graphical user interface, graphical web browsers developed by Microsoft which was used in the Microsoft Wind ...
browser. It was also forked by
Microsoft
Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
for the original
Edge browser, but Edge was later rebuilt as a Chromium-based browser and thus now uses V8.
References
{{DEFAULTSORT:JavaScript engine
engine
An engine or motor is a machine designed to convert one or more forms of energy into mechanical energy.
Available energy sources include potential energy (e.g. energy of the Earth's gravitational field as exploited in hydroelectric power ...