Async
ELI5 — The Vibe Check
Async means 'don't wait around'. You order food at a restaurant, then chat with friends instead of standing at the kitchen window staring. When the food is ready, the waiter brings it to you. Async code fires off a task and does other things until it's done.
Real Talk
Asynchronous programming allows a program to initiate a long-running operation and continue executing other code without blocking. The result is handled when available via callbacks, promises, or async/await syntax. Essential for I/O-heavy operations.
Show Me The Code
async function fetchUser(id: string) {
const response = await fetch(`/api/users/${id}`);
const user = await response.json();
return user;
}
When You'll Hear This
"Make that database call async so the server doesn't block." / "Async/await made the code so much cleaner than nested callbacks."
Related Terms
Concurrency
Concurrency is juggling multiple tasks at once — not necessarily at the exact same instant, but switching between them fast enough that they all seem to be...
Race Condition
A race condition is when two parts of your code are racing to do something at the same time and the winner isn't guaranteed — leading to unexpected, hard-t...
Side Effect
A side effect is when a function secretly does something beyond just giving you an answer — like changing a global variable, writing to a file, or sending...
Sync
Sync means one thing at a time, in order. You order food, stare at the kitchen wall, and only get to sit down when the food arrives.
Thread
A thread is a mini-worker inside your program that can run tasks independently.