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

100
Views
orden de salida implica promesa, cola de micro tareas en js

 new Promise((resolve, reject) => { console.log("promise1") resolve() }).then(() => { console.log("then11") new Promise((resolve, reject) => { console.log("promise2") resolve() }).then(() => { console.log("then21") }).then(() => { console.log("then23") }) }).then(() => { console.log("then12") })

El resultado del código anterior es el siguiente, cuando pruebo mi comprensión de la micro tarea y la tarea macro con promesa y no puedo obtener el resultado correcto.

 // "promise1" // "then11" // "promise2" // "then21" // "then12" // "then23"

Para ser más específico, estoy confundido acerca de las últimas 3 salidas. ¡Gracias por la ayuda!

 // "then21" // "then12" // "then23"
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si estás buscando esta salida:

 // "promise1" // "then11" // "promise2" // "then21" // "then23" // "then12"

Luego devuelva la Promesa dentro de su primer .then( , así:

 new Promise((resolve, reject) => { console.log("promise1") resolve() }).then(() => { console.log("then11") return new Promise((resolve, reject) => { console.log("promise2") resolve() }).then(() => { console.log("then21") }).then(() => { console.log("then23") }) }).then(() => { console.log("then12") })

El return devuelve la Promesa hecha por el último .then( en la cadena después de su segunda new Promise . Su último .then( esperará el then23 .then( , luego se ejecutará.

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!