Field Guide · language

Also known as: JavaScript, JS, ECMAScript

JavaScript (JS) is a dynamically typed, garbage-collected programming language and the only language that runs natively in every web browser; with Node.js it also runs on servers, letting one language cover the whole stack.1

JavaScript browser Node.js npm ecosystem
JavaScript runs in the browser and on the server (Node.js), sharing the vast npm ecosystem.

Overview

Modern JavaScript engines such as V8 JIT-compile the language to native code at runtime, so it is far faster than its scripting origins suggest.2 It is dynamically typed and garbage-collected, with an event-driven, asynchronous model at its core that suits I/O-bound web work. The standard is formally called ECMAScript, and the npm registry is among the largest package ecosystems in existence.

Strengths and trade-offs

Its defining strength is ubiquity: it is the one language guaranteed to run in every browser, and with Node.js you can write both client and server in it. The drawbacks are decades of quirky design decisions and famously loose, weak typing that lets subtle bugs slip through at runtime. TypeScript — JavaScript with a static type system layered on top — addresses the typing problem and compiles back down to plain JavaScript, which is why it has become the default for serious front-end and Node projects.

Where it’s used

JavaScript powers virtually all interactive web front-ends, a large share of server backends through Node.js, and much of modern build tooling. For larger codebases teams increasingly write TypeScript and ship the compiled JavaScript, but the runtime everywhere remains JavaScript itself.

Sources

  1. JavaScript — Wikipedia, for history and design background. 

  2. JavaScript — MDN Web Docs, the reference documentation for the language and its runtime behaviour. 

See also