Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Understanding JavaScript · Lesson 2 of 15

How JavaScript works

A free lesson from Swipe Coding · JavaScript, level 1 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
Every browser has its own engine quietly running your code under the hood. 🔧

Every browser (and Node.js) runs JavaScript using a JavaScript engine — a program built into the browser that reads your code and carries out its instructions. Chrome and Node.js both use an engine called V8; Firefox uses SpiderMonkey, and Safari uses JavaScriptCore. Each engine understands the same JavaScript language, just with its own internal implementation.

Unlike Java, which you compile ahead of time into bytecode before you can run it, JavaScript is interpreted: the engine reads and runs your code directly, without you performing a separate compile step first. Modern engines like V8 actually use a technique called JIT (Just-In-Time) compilation behind the scenes to make this fast — but from where you sit, you simply write code and run it immediately.

console.log('This runs immediately — no separate compile step needed.');
There is no build step you have to trigger yourself here — the engine reads this line and executes it right away.
Fill in the blank

The program that reads and executes your JavaScript code is called a ____.

🤖
One thing at a time, in order — no juggling required. 🎯

JavaScript also runs on a single thread, which means it can only do one thing at a time — executing your code line by line, in order. This is simpler to reason about than juggling many things simultaneously, but it also means one slow piece of code can delay everything else until it finishes running.

Quick check

Which engine does Google Chrome and Node.js use to run JavaScript?

True or false

JavaScript must be compiled ahead of time into a separate file before it can run, just like Java.

JavaScript's single-threaded, line-by-line nature is one reason it later grew features like callbacks and promises for handling slow operations (like fetching data) without freezing the rest of the page — but that's a topic for a later level.

Keep your streak going in Swipe Coding

Swipe through every level of JavaScript on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →