The language of the web — a dynamic, garbage-collected, single-threaded language with first-class functions, now running everywhere from browsers to servers to phones.
Why JavaScript?
A short history
| Year | Milestone |
|---|---|
| 1995 | Brendan Eich writes it in ~10 days at Netscape (Mocha → LiveScript → JavaScript). |
| 1997 | Standardised as ECMAScript 1 by Ecma International. |
| 2009 | ES5: strict mode, JSON, Array.prototype.map/filter/reduce. Node.js is released. |
| 2015 | ES6 / ES2015 — the big one: let/const, arrows, classes, modules, promises, destructuring, Map/Set. |
| 2016 → | Yearly editions: async/await (2017), ?. and ?? (2020), top-level await (2022), toSorted (2023), Object.groupBy (2024)… |
Engines and runtimes
An engine parses and executes JavaScript. A runtime wraps an engine and adds APIs to talk to the outside world (DOM, files, network, timers).
| Engine | Used by |
|---|---|
| V8 (C++) | Chrome, Edge, Node.js, Deno, Electron |
| SpiderMonkey | Firefox (the first JS engine ever) |
| JavaScriptCore | Safari, Bun, React Native (with Hermes as an alternative) |
| Runtime | Extra APIs it provides |
|---|---|
| Browser | window, document (DOM), fetch, localStorage, setTimeout, events |
| Node.js | fs, path, process, http, Buffer, EventEmitter, CommonJS + ESM modules |
| Deno / Bun | Node-compatible APIs, built-in TypeScript, secure-by-default (Deno) |
Your first program
const language = "JavaScript";
const year = 1995;
console.log(`Hello, ${language}! Born in ${year}.`);
console.log(typeof language, typeof year);
console.log([1, 2, 3].map((n) => n * 2));Hello, JavaScript! Born in 1995.
string number
[ 2, 4, 6 ]$ node --version # check Node
$ node app.js # run a file
$ node # interactive REPL (.exit to quit)
$ node --watch app.js # re-run on every saveIn a browser, open DevTools (F12) → Console and type expressions directly, or load a file with <script src="app.js" defer></script>.