JavaScript

Last edited by dave on 30/11/2025, 12:45:16 UTC

JavaScript

You were redirected here from JS.

Contents

Logo of JavaScript

Quick Snapshot

  • Type: High-level, dynamic, multi-paradigm programming language.
  • First released: 1995 (by Brendan Eich at Netscape).
  • Standard: ECMAScript (maintained by TC39).
  • Primary domain: Web — but also servers, desktop, mobile, IoT, and scripts everywhere.
  • Not to be confused with: Java. (Different languages. Same caffeine jokes.)
  • Website: ecma-262

A Brief History (That Escalated Quickly)

  • 1995: Created in ~10 days as “Mocha,” then “LiveScript,” finally JavaScript.
  • Late 1990s–2000s: Browser wars; JS becomes the duct tape of the web.
  • 2009: Node.js arrives, turning JS into a full-stack citizen.
  • 2015 onward: Annual ECMAScript releases (ES2015/ES6 and beyond) bring classes, modules, arrow functions, promises, let/const, and more modern goodness.

Core Concepts

The Language

  • Dynamic & loosely typed: Variables can change type like they’re trying on outfits.
  • Prototype-based objects: Inheritance via prototypes instead of classical classes (though class syntax exists).
  • First-class functions: Functions are values; callbacks and higher-order functions are the norm.
  • Single-threaded with an event loop: Concurrency is managed via callbacks, promises, and async/await.

Types (the usual suspects)

Number, String, Boolean, Null, Undefined, BigInt, Symbol, Object
(And yes, typeof null === "object" — we don’t talk about that.)


Syntax & Features You’ll Meet Quickly

Also check out the full cheat sheet of JavaScript.

// Variables const answer = 42; // block-scoped, read-only binding let mood = "curious"; // block-scoped, reassignable var legacy = true; // function-scoped, use sparingly // Functions const add = (a, b) => a + b; // Objects & Destructuring const user = { name: "Ava", role: "Editor" }; const { name, role } = user; // Arrays & Spread const arr = [1, 2, 3]; const arr2 = [...arr, 4]; // Template literals const greeting = `Hello, ${name}!`; // Promises & async/await const getData = async (url) => { const res = await fetch(url); return res.json(); };

The Runtime & Environment

  • Browsers: Provide the DOM, fetch, localStorage, and the sandbox where UI magic happens.
  • Node.js: Provides V8 outside the browser, plus modules, filesystem, networking, and server-side power.
  • Deno/Bun: Modern runtimes with batteries included, fresh takes on packaging and performance.

Modules

  • ES Modules: import / export (native in modern browsers and Node).
  • CommonJS: require / module.exports (classic Node style).
  • Tooling can bridge the gap when you mix ecosystems.

The Ecosystem & Tooling

  • Package managers: npm, pnpm, yarn.
  • Bundlers & builders: Vite, esbuild, Rollup, Webpack, Parcel.
  • Transpilers: Babel (for language features before engines catch up).
  • Linters & formatters: ESLint, Prettier (because code style debates should be automated).
  • Frameworks: React, Vue, Angular, Svelte, Next.js, Astro — choose your adventure.
  • Testing: Vitest, Jest, Mocha, Playwright, Cypress.

Use Cases (Beyond Clicking Buttons)

  • Front-end apps: Interactive UIs, SPAs, PWAs.
  • Back-end APIs: REST/GraphQL with Node (Express, Fastify, NestJS).
  • Desktop & Mobile: Electron, Tauri, React Native, NativeScript, Expo.
  • Automation & CLIs: Scripts, build tools, bots.
  • Edge & Serverless: Cloud Functions, Workers, and low-latency edge runtimes.

Standards & Governance

  • ECMAScript is the spec; TC39 proposes, discusses, and stages features (0–4).
  • Major engines (V8, SpiderMonkey, JavaScriptCore, Chakra legacy) implement and ship; annual releases keep the language evolving.

Interop & The Web Platform

  • DOM & BOM: Manipulate documents, windows, storage, and network.
  • Web APIs: fetch, WebSockets, Web Workers, WebAssembly, Canvas, WebGL/WebGPU, Web Crypto, and more.
  • TypeScript: A popular typed superset that compiles to JavaScript and keeps your large codebases civilized.

Idioms & Gotchas (Because Every Language Has Them)

  • Truthiness/falseiness: 0, "", null, undefined, NaN, and false are falsy; the rest are truthy.
  • Equality: Prefer === over == to avoid “creative” coercion.
  • this binding: Depends on call site; arrow functions don’t rebind it.
  • Async pitfalls: Mind your awaits; unhandled rejections bite later.

Fun Facts

  • Built in a rush, now runs the whole world — poetic.
  • The name “JavaScript” was a marketing decision; the language is its own thing.
  • You can write an entire stack in one language, front to back (and sideways).
Backlinks (12)
Categories (0)

    No categories assigned to this page.

Edit Level

> Signed In Users