Promise Chain Order
NodeJS
Hard
4 views
Problem Description
Show the execution order between sync code, Promise.then, and setTimeout.
Output Format
Print lines in correct order.
Constraints
Understand microtask vs macrotask.
Official Solution
console.log('A');
Promise.resolve().then(() => console.log('C'));
setTimeout(() => console.log('D'), 0);
console.log('B');
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!