single-threaded
Able to run only one piece of code at a time, as JavaScript on the main thread is.
In more detail
Concurrency in the browser comes from the event loop interleaving tasks, not from running them in parallel. True parallel JavaScript needs Web Workers.
Related terms
- event loop — The central loop of an asynchronous program that waits for events, such as timers firing or data arriving, and runs the matching callbacks.
- main thread — The first thread a program starts with; in a browser page it also runs JavaScript and handles input, layout and painting.
- Web Worker — A script that runs on its own background thread, separate from the page's main thread, so heavy computation does not freeze the page.
Taught in
- The Browser Event Loop: Call Stack, Microtasks And Macrotasks — Frontend Architecture & Web Platform