#async
Promises
JavaScript is single-threaded — it can only do one thing at a time. But web applications need to fetch data from servers, read files, and wait for user input without freezing the page. Promises are how JavaScript handles these asynchronous operations: they represent a value that doesn’t exist yet but will (or won’t) in the future. The Problem Promises Solve Before promises, async code used callbacks. This worked for simple cases but quickly became unmanageable: Read more →
May 18, 2026
Async/Await
Async/await is syntactic sugar on top of Promises. It lets you write asynchronous code that reads like synchronous code — no more .then() chains. Under the hood, it’s still promises, but the code is dramatically easier to read and reason about. The Basics Mark a function as async, then use await inside it to pause until a promise resolves: async function getUser(id) { const response = await fetch(`/api/users/${id}`); const user = await response. Read more →
May 18, 2026