What is JavaScript?
JavaScript is a high-level, dynamically typed, single-threaded programming language. It was created in 1995 by Brendan Eich at Netscape to make web pages interactive. Thirty years later it is one of the most widely deployed languages on earth, running in every browser, on most servers, inside mobile apps, on edge networks, and inside the runtimes that host AI agents and developer tools.
The shorthand: JavaScript is the language the web runs on. The longer answer is that "the web" has expanded a long way past the browser, and JavaScript has gone with it.
Always bet on JavaScript.- the practical rule for the last twenty years
The shape of the language
JavaScript's core feels familiar if you have written any C-family language - curly braces, semicolons, functions, loops. But under that surface it has its own personality:
- Dynamic and weakly typed. A variable can hold a string, then a number, then an object, then a function. No compile step refuses your code; the runtime tries to make whatever you wrote do something.
- First-class functions. Functions are values you can pass around, return from other functions, and store in variables. The functional patterns most modern frameworks use (callbacks, higher-order functions, hooks) rest on this.
- Prototype-based objects. JavaScript's object model uses prototype chains rather than classical inheritance. The
classsyntax introduced in ES2015 is sugar over prototypes, not a new system. - Single-threaded with an event loop. One main thread runs your code, with an event loop that interleaves asynchronous work. Read the event loop article for the deep dive.
- Closures. A function "captures" the variables in scope when it was defined. This sounds academic; in practice it is how nearly every callback-based pattern works.
// First-class functions + closures, the JavaScript way
function counter() {
let n = 0;
return () => ++n;
}
const next = counter();
next(); // 1
next(); // 2
Where it runs
JavaScript started in the browser and stayed there for a decade. The expansion came in 2009 when Ryan Dahl took the V8 JavaScript engine out of Chrome and built Node.js - a server runtime that gave JavaScript access to the filesystem, the network, child processes, and everything else the operating system exposes.
Today the major hosts are:
- Browsers - Chrome's V8, Safari's JavaScriptCore, Firefox's SpiderMonkey. The original home.
- Node.js - the dominant server runtime. The default answer for "I need to run JavaScript outside a browser."
- Bun - a newer, faster all-in-one runtime + package manager + bundler, designed as a Node.js replacement.
- Deno - a secure-by-default runtime from the same person who created Node, designed to fix Node's early design mistakes.
- Edge runtimes - Cloudflare Workers, Vercel Edge, Netlify Edge. Lightweight V8-isolate runtimes for code that runs close to users.
- Embedded - mobile apps via React Native, desktop apps via Electron, even microcontrollers via projects like Espruino.
The practical consequence: JavaScript is the only mainstream language whose default deployment story is "everywhere."
What it is not
Two confusions worth clearing up.
- JavaScript is not Java. Naming accident. JavaScript was originally called Mocha, then LiveScript, then renamed JavaScript in 1995 to ride Java's marketing momentum. The languages share some syntax (curly braces, similar keywords) and almost nothing else.
- JavaScript is not "scripting only." The "Script" in the name predates a serious type system, a serious module system, and serious tooling. All three landed in the 2010s. Modern JavaScript codebases routinely run hundreds of thousands of lines in production and ship through pipelines as sophisticated as anything in Java or C#.
JavaScript vs ECMAScript
The language has two names. JavaScript is the trademarked name (Oracle owns the trademark, inherited from the Java/Mocha era). ECMAScript is the official standard, maintained by the TC39 committee at Ecma International. They describe the same language.
The version numbers track ECMAScript releases:
- ES5 (2009) - the long-stable version most browsers settled on for years.
- ES2015 (also called ES6) - a huge release that added
let/const, arrow functions, classes, modules, promises, template literals, destructuring. Most "modern JavaScript" syntax dates from here. - ES2016 onward - yearly small releases adding features incrementally (
async/await, optional chaining, nullish coalescing, top-levelawait, the?.operator, and a steady drip of useful additions).
When a tutorial says "this is ES2022 syntax," it means "feature added in the 2022 ECMAScript release." In practice, modern runtimes ship support fast enough that you rarely worry about it.
Why it stuck
JavaScript has been declared "the worst language" almost continuously since 1996 and is still the most-deployed language in the world. The reason it stuck is not technical merit - it is that JavaScript is the only language a browser will run by default. Every other language reaches the browser by compiling down to JavaScript (or WebAssembly, which JavaScript supervises).
Once it owned the browser, the rest followed: Node.js took it to the server, frameworks took it to mobile, edge runtimes took it to the network. The language got better in parallel - TypeScript added a serious type system on top, build tools got fast, the standard library quietly grew. By 2026 the version of JavaScript you write daily has almost nothing in common with the one Brendan Eich shipped in ten days in 1995.
For the deeper story of how it got here - the standards fights, the framework wars, the rise of Node - read The history of JavaScript. For the language layer underneath modern frontends, read What is TypeScript?. For how a single-threaded runtime handles concurrency without blocking, read The event loop in JavaScript.