We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

JavaScript Runtimes

Click to play video

A runtime environment is where your program runs. The runtime you choose will determine things like:

  • What APIs are available to your code (fetch, canvas, etc.)
  • How your code is executed (JIT compiled vs interpreted)
  • What dependencies you'll need in production
  • Whether you run on the backend (a server) or frontend (a browser or mobile app)

Examples of Runtimes

  • The browser (we try to pretend they're the same, but in reality different browsers are different runtimes)

  • Node.js

  • A web worker within a browser

  • Deno.js

  • Bun

Originally, JavaScript only ran in browsers. Today, it runs almost everywhere.

Which Runtime Should I Use?

If you're doing frontend web development, congratulations, you're using the browser. You likely have to support all the major browsers, so you'll need to know what APIs are available in each.

If you're doing backend development, you get to choose. Node.js is the oldest and most popular, Deno and Bun are newer and less mature, but have some cool features (like native TypeScript support) and claim to be faster. In reality, they're all very similar to work with. You don't need to "learn" a runtime to be able to work with it, if you understand JavaScript, you can work with any of them.