Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Create a timeout promise that rejects after the specified milliseconds, then race it against the original promise using Promise.race. Whichever settles first determines the outcome.
Promise.race resolves or rejects as soon as either the real promise or the timeout promise settles, providing a simple deadline mechanism.
Updated Feb 2026