Update 3_async-await.js

This commit is contained in:
xfarrow 2025-01-08 13:01:01 +01:00 committed by GitHub
parent 374f29c955
commit 04ab3177d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,8 +41,10 @@ console.log('End')
// The result will be:
// Start, Before Await, End, After await
// "End" comes before "After Await" because the
// flow of execution goes to the caller
// when await is invoked.
// flow of execution goes to the caller of exampleAsyncFunction
// because "setTimeout(() => resolve('done'), 500)" gets enqueued in
// the Event Loop Thread and "console.log('After await')" can be executed
// only when the promise has resolved.
// Questions
//