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

229
Views
Can you use 2 async functions at the same time when working with 2 .json files? (Two different .json text files)

If not then how can you work with 2 .json files at the same time? It does't seem to work so if there exists another method I should try and use that. If you could provide the correct syntax to achieve the goal it would be appreciated. Does the second .json file ever get processed?

sync function populate() {

    const requestURL = 'nascar.json';
    const request = new Request(requestURL);
    
    const response = await fetch(request);
    const nascarDrivers = await response.json();
    
    findDriver(nascarDrivers);
}

async function texas() {

    const requestURL = 'texasMS.json';
    const request = new Request(requestURL);
    
    const response = await fetch(request);
    const texasLaps = await response.json();
    
    findLaps(texasLaps);
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you run them one by one, without awaiting them, they will run in parallel (sort-of).

populate()
texas()

If you want to wait for the results as they come back, you can use Promise.all:

const promises = [
  populate(),
  texas(),
]
Promise.all(promises).then((results) => {
  const [populateRes, texasRes] = results
  // ...
})
// or
const results = await Promise.all(promises)
about 4 years ago · Juan Pablo Isaza 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!