JavaScript · Promises · async/await · Interactive

Async JS,
finally makes sense

Promises, async/await, fetch(), and all concurrency methods — with animated flow diagrams and real API scenarios.

example.js
// From callback hell...
getUser(id, (err, user) => {
  getPosts(user.id, (err, posts) => {
    // 😱 nested forever
  });
});
// ...to async/await
async function load(id) {
  const user  = await getUser(id);
  const posts = await getPosts(user.id);
  return { user, posts };
}
// Even better — parallel
const [user, posts] = await Promise.all([
  getUser(id), getPosts(id)
]);

5 real-world scenarios

All methods at a glance

Concurrency
Promise.all()Promise.allSettled()Promise.race()Promise.any()
Static creation
Promise.resolve()Promise.reject()Promise.withResolvers()Promise.try()
.then().catch().finally()
Keywords
async functionawaitfor await...of
View full reference →