What is JavaScript written in?
What JavaScript is used for
JavaScript runs in every web browser, so it is the language of interactive front-end development; with Node.js it also runs servers, build tools, and desktop apps. Frameworks like React, Vue, and Angular are built in it, and it powers everything from single-page apps to serverless functions.
Notable software: virtually every modern website's interactivity, plus desktop apps built on Electron such as VS Code, Slack, and Discord.
About JavaScript
JavaScript is a high-level programming language. It is a dynamically typed and garbage-collected language that compiles to bytecode that runs on a virtual machine. It supports imperative, object-oriented, and functional programming. Compiling to bytecode for a virtual machine is the same model the JVM and .NET use: the VM, not the CPU, interprets or JIT-compiles the bytecode.
JavaScript first appeared in 1995 and was designed by Brendan Eich. Today JavaScript is one of the most widely used programming languages in the world.
JavaScript in the language family tree
JavaScript drew on ideas from Smalltalk, Java, Scheme, Self, and Lisp and went on to influence TypeScript, CoffeeScript, Dart, ReasonML, Solidity, and ActionScript.
Sources: Wikipedia · Wikidata · Official site
Quick Facts
- Short answer
- Modern JavaScript engines are mostly C++
- Specification
- ECMAScript
- Major engines
- V8, SpiderMonkey, JavaScriptCore
- Historical note
- Original SpiderMonkey began in C
JavaScript language vs JavaScript engines
JavaScript source code runs inside an engine. The ECMAScript specification, maintained by TC39 and published by Ecma International, defines the language: its syntax, semantics, and standard library. Engines such as V8, SpiderMonkey, and JavaScriptCore implement that specification. A JavaScript program is not "written in" a particular language any more than a PDF document is "written in" Acrobat; the engine is the implementation.
That distinction matters when answering "what is JavaScript written in?" The answer that is actually useful is about engines, because the engines are what run on your machine. V8 powers Chrome and Node.js. SpiderMonkey powers Firefox. JavaScriptCore powers Safari. Every major engine writes its performance-critical compilation and runtime code in C++, which gives it the low-level control needed to JIT-compile JavaScript to native machine code at acceptable overhead.
TypeScript, Babel, and other transpilers are written in JavaScript or TypeScript. They are pre-processing tools, not engines. They transform source code before it reaches an engine, but they do not define how JavaScript executes.
How modern JavaScript engines compile code
Modern JavaScript engines do not interpret source code line by line. They use a multi-tier compilation pipeline that trades compilation cost against execution speed based on how often each function runs.
V8's pipeline illustrates the pattern. First, V8 parses JavaScript into an AST and compiles it to Ignition bytecode, a compact intermediate representation. Ignition executes bytecode immediately. While it runs, V8 tracks how many times each function is called and what types its arguments receive. Functions that exceed a hotness threshold are handed to TurboFan, V8's optimizing JIT compiler, which generates highly tuned machine code based on the observed types. V8 introduced Maglev in 2023 as a mid-tier between Ignition and TurboFan, reducing compilation latency for medium-hot functions.
Speculative optimization is key. TurboFan assumes that a variable that has always been an integer will continue to be one, and generates fast integer code. If that assumption breaks because a string arrives, the engine deoptimizes: it throws away the compiled code and falls back to Ignition, then potentially recompiles with the wider type profile. This cycle is invisible to developers but drives JavaScript performance on tight loops and server-side Node.js workloads.
Major JavaScript engines
| Engine | Written in | Used by | JIT tiers |
|---|---|---|---|
| V8 | C++ | Chrome, Node.js, Deno, Electron | Ignition, Maglev, TurboFan |
| SpiderMonkey | C++, Rust, JavaScript | Firefox | Baseline JIT, IonMonkey |
| JavaScriptCore | C++ | Safari and WebKit | LLInt, Baseline JIT, DFG, FTL |
| Hermes | C++ | React Native | AOT bytecode, minimal JIT |
| QuickJS | C | Embedded environments | Interpreter only |
JavaScript release history
Brendan Eich created JavaScript in ten days in May 1995 while at Netscape, under a brief to make Navigator's pages interactive without requiring a Java applet. It shipped as LiveScript, was renamed JavaScript for marketing reasons, and had little in common with Java beyond the name and some syntax surface. Microsoft's JScript reverse-engineered it for Internet Explorer shortly after.
Ecma International standardized the language as ECMAScript. ES1 was published in June 1997. ES3 (1999) added regular expressions and try/catch and became the de-facto baseline for the 2000s. ES5 (2009) added strict mode, JSON support, and Array methods. ES6, rechristened ES2015, was the biggest release in the language's history: classes, arrow functions, promises, modules, template literals, destructuring, and generators.
Since ES2016, TC39 has shipped a new ECMAScript edition every June. Major additions include async/await (ES2017), optional chaining and nullish coalescing (ES2020), top-level await (ES2022), and array grouping and set operations (ES2024). The V8 and SpiderMonkey teams typically ship new syntax within months of TC39 Stage 4 approval.
Frequently Asked Questions
Evidence Sources
- https://spidermonkey.dev/
- https://auth0.com/blog/a-brief-history-of-javascript/
- https://www.typescriptlang.org/
- https://en.wikipedia.org/wiki/CoffeeScript
- https://en.wikipedia.org/wiki/Dart_(programming_language)
- https://reasonml.github.io/
- https://coffeescript.org/
- https://elm-lang.org/
- https://www.purescript.org/
- https://nim-lang.org/docs/backends.html
- https://dart.dev/web
- https://en.wikipedia.org/wiki/JavaScript
- https://en.wikipedia.org/wiki/ReScript
- https://en.wikipedia.org/wiki/Solidity
- https://en.wikipedia.org/wiki/ActionScript
- https://en.wikipedia.org/wiki/Babel_(transcompiler)
- JavaScript on Wikidata (Q2005)