79543379

Date: 2025-03-29 14:32:23
Score: 1
Natty:
Report link

i asked to a friend of mine called chatgpt... haha... and it answered -> "🧠 No — await and .then() both schedule microtasks with the same priority. However, the timing and nesting of async calls can affect the order in which microtasks are created and executed." I belive consfusion was caused because second code... After console.log("Inner") runs, control returns to outer() where it continues with console.log("Outer"), but this continuation is itself wrapped in another microtask because the await inner() also pauses and changes the timing of outer(). So, each await pauses and schedules the next part of the async function as a new microtask. Therefore, deep chains of await can introduce additional levels of microtasks, which is why "Outer" comes after "Then". I hope I helped ;)

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Rodrigo Eduardo Pereira Ramos