Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
Can JavaScript execute two asynchronous functions or callbacks at the same time?

Can JavaScript execute two asynchronous functions or callbacks at the same time? Or does it execute the first one and wait until it is finished then executes the other?

For example, let's say I made two requests and the two returns the response at the same time will JavaScript executes the two functions handleResponse1 and handleResponse2 at the same time.

async function handleResponse1 () {/* some code */}
async function handleResponse2 () {/* some code */}

fetch('https://github.com').then(handleResponse1);
fetch('https://stackoverflow.com').then(handleResponse2);

Another example is if my express server receives three requests for three different endpoints (/users, /courses and /products) at the same time will JavaScript executes getUsers, getCourses and getProducts at the same time.

async function getUsers () {/* some code*/}
async function getCourses () {/* some code*/}
async function getProducts () {/* some code*/}

app.get('/users', getUsers);
app.get('/courses', getCourses);
app.get('/products', getProducts);

The last example is if I read a file and Nodejs returns its data at the same that my express server receives a request will JavaScript execute processFileData and processRequestData at the same time.

async function processFileData () {/*some code*/}
async function processRequestData () {/*some code*/}

fs.readFile('/test.txt', 'utf8' , processFileData)
app.get('/some-endpoint', processRequestData);
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda