~/VibeHandbook
$39

Languages

developer.mozilla.org

JavaScript

What it is

JavaScript is the language of the web. It is the only one that runs natively in every browser. Through Node, Deno, and Bun, it also runs on servers, so you can build a whole app with it. It checks your data only while the program is running, not before — like writing out a recipe with no ingredient checklist, where a missing item is discovered only mid-cooking (this is called being "dynamically typed"). It is also event-driven and everywhere, which makes it the most widely used programming language in the world.

Strengths

  • Runs everywhere: browsers, servers, functions, even embedded.
  • No compile step; edit and refresh for instant feedback.
  • Massive npm (Node Manager) 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 sprawl without discipline.
  • Same-language / 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);