JavaScript
JavaScript is a high-level, dynamically typed, interpreted programming language. It began as the scripting language of the web browser, but has since spread into virtually every computing context: servers, the cloud edge, native mobile and desktop applications, Smart TVs, and even microcontrollers. No other language has achieved quite the same breadth of deployment, making JavaScript arguably the most ubiquitous programming language in existence.
JavaScript’s behavior is governed by the ECMAScript specification. TypeScript is a statically typed superset of JavaScript that compiles down to JavaScript.
History
JavaScript was created by Brendan Eich at Netscape in 1995, reportedly in just ten days. It was first released under the name Mocha, then LiveScript, and finally JavaScript — a name chosen partly for marketing reasons, to capitalize on the popularity of Java at the time, despite the two languages having very little in common.
In 1996, Netscape submitted JavaScript to ECMA International for standardization, resulting in the ECMAScript specification. Microsoft developed their own compatible implementation, JScript, to avoid trademark issues.
For many years, browser incompatibilities made cross-browser JavaScript development painful. The rise of libraries like jQuery in the mid-2000s helped smooth over these differences. Later, the maturation of the ECMAScript specification and the standardization of modern browser APIs largely resolved the problem.
The release of Node.js in 2009 took JavaScript outside the browser for the first time, enabling its use for server-side and command-line applications. JavaScript is now one of the most widely used programming languages in the world.
Characteristics
-
Dynamically typed: Variable types are determined at runtime. A variable can hold any type of value, and that type can change over the lifetime of the variable.
-
Interpreted: JavaScript source code is executed directly by the JavaScript engine without a mandatory separate compilation step. Modern engines use JIT (just-in-time) compilation internally to improve performance, but this is transparent to the developer.
-
Prototype-based object-oriented: Rather than classical class-based inheritance, JavaScript uses a prototype chain for object inheritance. The
classsyntax introduced in ES2015 is syntactic sugar over this prototype model. -
First-class functions: Functions are values. They can be assigned to variables, passed as arguments to other functions, and returned from functions.
-
Single-threaded: JavaScript executes on a single thread. Long-running synchronous operations block execution of all other code.
Event loop
JavaScript’s concurrency model is built around the event loop. Despite being single-threaded, JavaScript handles non-blocking I/O through an asynchronous programming model. Callbacks, Promises, and async/await all allow work to be deferred and resumed without blocking the call stack. The event loop continuously processes a task queue, executing deferred callbacks when the call stack is empty.
This model is well suited to I/O-bound workloads such as network requests and file system access, but poorly suited to CPU-bound tasks, which block the event loop and degrade responsiveness.
Closures
A closure is a function that captures and retains access to variables from its enclosing scope, even after that outer scope has finished executing. Closures are fundamental to many JavaScript patterns, including module encapsulation, callbacks, and factory functions.
Modules
JavaScript’s native module system, introduced in ES2015, allows code to be organized into files with explicit import and export declarations. Prior to native modules, systems like CommonJS (require / module.exports) — still common in Node.js codebases — served the same purpose.
Environments
JavaScript began as a browser-only language, but over the last two decades it has spread into virtually every computing context. No other language has achieved quite the same breadth of deployment, which is a large part of what makes it a strategically safe choice.
Browser
The browser remains JavaScript’s native habitat. The major engines — V8 (Chrome, Edge), SpiderMonkey (Firefox), and JavaScriptCore (Safari) — each handle parsing, JIT compilation, garbage collection, and integration with Web APIs. These engines are also the foundation for most JavaScript runtimes outside the browser.
Server and cloud
Node.js (2009) was the breakthrough that took JavaScript server-side. Built on V8, it introduced an event-driven, non-blocking I/O model that proved well suited to networked applications, and it ships with npm — the world’s largest package registry.
Deno followed in 2018 as a security-focused alternative from Node.js’s original creator Ryan Dahl, with built-in TypeScript support and web-standard APIs. Bun (2022) is a more recent high-performance runtime built on JavaScriptCore that bundles a transpiler, bundler, and package manager into a single tool.
Edge computing
Edge runtimes execute JavaScript in data centers that are geographically close to the user, minimizing latency. Cloudflare Workers (2017) pioneered this model with a purpose-built minimal runtime based on the Service Worker API. Deno Deploy and similar offerings from other providers have since followed. These runtimes are deliberately constrained — they sacrifice full Node.js compatibility in favor of fast startup times and low resource use.
Native mobile and desktop apps
JavaScript is widely used to build native applications via cross-platform frameworks. React Native (2015) renders native platform views driven by a JavaScript engine (originally JavaScriptCore, now typically Hermes, a purpose-built engine from Meta). Electron (2015) takes a different approach, bundling a full browser engine and Node.js together to create desktop apps — VS Code, Slack, and Discord are notable examples. Capacitor/ Cordova embed web views into native app shells and are popular for mobile targets.
Smart TVs and embedded devices
Many Smart TV platforms (HbbTV, webOS, Tizen, Amazon Fire TV) run JavaScript-based apps, often via browser-based runtimes or Cordova. Over a billion internet-connected TV devices are estimated to run JavaScript in some form.
At the other extreme, ultra-lean engines such as Duktape, JerryScript, and Moddable’s XS runtime bring JavaScript to microcontrollers with kilobytes of RAM, enabling it on IoT sensors, thermostats, and similar devices.
Polyglot interop
JavaScript engines are also embedded within runtimes for other languages, enabling cross-language interop. Graal.js runs on the JVM and supports calling Java from JavaScript and vice versa. Engines like jint (.NET/C#) and Boa (Rust) serve similar purposes in their respective ecosystems.
Ecosystem
The JavaScript ecosystem is vast. Key tooling includes:
-
npm / pnpm / Yarn: Package managers and registries.
-
Vite / esbuild / webpack: Bundlers and build tools.
-
React, Vue, Svelte, Angular: Front-end UI frameworks and libraries.
-
Express, Fastify, Hono: Server-side web frameworks.
-
Vitest, Jest: Testing frameworks.