A JavaScript engine is a tool that executes JavaScript code.
There are two types of JavaScript engines from the point of view of operation:
- runtime interpretes
- JIT: just-in-time compilation
Runtime interpreters have less performance than just-in-time compilations because they do not have native compilation to machine code or the possibility of using executable pre-compiled as most browser JavaScript engines have added for WebAssembly support since 2017.
From the point of view of the scope of execution there are the following types of JavaScript engines:
- execution in browser: javascript was born for browsers
- execution on server: javacript is so efficient in performance that it has engines for execution outside of web browser, as is the engine that uses NodeJS.
Browser engines run JavaScript in direct relation to the browser's rendering engine through the Document Object Model
And since ECMAScript is the standard JavaScript specification to put a little order in the appearance of different javascript dialects as is the case of JScript created by Microsoft for the Internet Explorer browser that had many incompatibilities, it can be said that JavaScript engines can be divided relative to this concept into:
- Meet ECMAScript specifications
- Do not meet ECMAScript specifications
The first JavaScript engine was created by Brendan Eich in 1995 for the Netscape browser, being initially an interpreter. This engine is known by the name SpiderMonkey (browser layout engine: Gecko) and is maintained by the Mozilla Foundation, being currently a just-in-time compilation to obtain greater performance with a compilation in the execution.
Another browser engine is the V8 engine (browser layout engine: Blink) was created by Google for its Chrome browser.
Apple implemented the Nitro engine, also known as JavaScriptCore (browser layout engine: WebKit), for its Safari browser, which surpassed its prodecesor with a performance improvement of 30%.
Furthark (browser layout engine: WebKit) is an engine of the Opera browser for its versions 9.50 to 10:10 that met the ECMAScript specifications.
There are also engines that are not for the browser, the most famous being the V8 engine, which is a core component of the NodeJS runtime, of other runtimes such as Deno.
Oracle has a javascript engine called Nashorn that has been used since its version 9 of the Oracle Java Development Kit (JDK).
On the next page of Wikipedia you can see a list of ECMAScript engines:
And on the next page the different specifications presented by the different javascript engine browser specifications are detailed:
In different entries of this JavaScript tutorial we will detail how to identify the engine of a browser, and the use of different JavaScript engines on the server, focusing most of this tutorial on the V6 engine of NodeJS.