Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Which of these correctly runs two async operations in parallel?

  1. A const a = await getA(); const b = await getB();
  2. B const [a,b] = await Promise.all([getA(), getB()]);
  3. C await getA(); await getB();
  4. D for (const f of [getA,getB]) await f();
Answer

const [a,b] = await Promise.all([getA(), getB()]);

Sequential awaits start the second request only after the first completes. Promise.all starts both immediately and waits for both.

All Javascript MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as