Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
Do these two async functions run in parallel?

Let's say we have two async functions like so:

const getUrl = async () => ...logic

const getName = async () => ...logic

and then I want to define an object which the values of the keys are these functions such as:

const defineObject = async() => {

   const obj = {
      url: await getUrl()
      name: await getName()
   }
}

Is this going to behave as generally JS does where it waits for the first async function to run getUrl() and then runs the second async function getName(), or, does it run them in parallel.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

No, they won't run in parallel. Each use of await turns into a getXXX().then(), with the code after it put into the .then() callback function.

If you want to do that, you can use Promise.all().

const [url, name] = await Promise.all([getUrl(), getName()]);
const obj = {url, name};
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!