⬅️ Execute Program JavaScript Concurrency
Promise constructor is synchronous
- When we do
new Promise(...)
and pass a callback to the constructor, that cb is ran immediately (even if you wrapped with asetTimeout
)
- but
then
always works async - 💡 Constructor callbacks always run immediately and synchronously, while
then
callbacks are scheduled to run asynchronously.