Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

231
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda