Load two things at the same time

Start both requests together instead of waiting for the first one to finish.

AJAX · Load two things at the same timeBeginner
async function loadDashboard() {
  const [users, orders] = await Promise.all([
    fetch('/api/users').then(function (r) { return r.json(); }),
    fetch('/api/orders').then(function (r) { return r.json(); })
  ]);
  return { users: users.items.length, orders: orders.items.length };
}

loadDashboard().then(console.log);
Promise.allparallelfetchspeed