~/VibeHandbook
$39

Languages

developer.mozilla.org

JavaScript

What it is

JavaScript is the language of the web — the only one that runs natively in every browser — and, via Node, Deno, and Bun, a full server-side platform too. It is dynamically typed, event-driven, and ubiquitous, making it the most widely deployed programming language in the world.

Strengths

  • Runs everywhere: browsers, servers, edge functions, even embedded.
  • No compile step; edit and refresh for instant feedback.
  • Massive npm ecosystem and a huge community.
  • First-class async with promises and async/await.

Trade-offs

  • No static types — many errors only surface at runtime.
  • Historical warts: loose equality (==), this binding, implicit coercion.
  • Easy to create callback or dependency sprawl without discipline.
  • Same-language frontend/backend can blur architectural boundaries.

When to reach for it

Reach for plain JavaScript for quick scripts, small projects, learning, prototypes, or environments where adding a build step isn't worth it. For anything larger or longer-lived, most teams reach for TypeScript instead — but JS remains the fastest way to get something running in a browser or a small Node tool.

Vibe coding fit

AI assistants handle JavaScript fluently, but the lack of types means generated code can silently assume the wrong data shape. Direct the AI to use modern syntax (const/let, arrow functions, async/await, modules) and strict equality, and ask it to add defensive checks or JSDoc comments where data shapes matter. Specify your environment — browser vs. Node, ESM vs. CommonJS — so imports are correct. Because there is no compiler to lean on, ask for a small runnable example or test so you can verify behavior directly.

const fetchTitle = async (url) => {
  const res = await fetch(url);
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const html = await res.text();
  return html.match(/<title>(.*?)<\/title>/i)?.[1] ?? "(no title)";
};

fetchTitle("https://example.com").then(console.log);