Practice ยท 3 of 3
Timeout Race
Write async function withDeadline(task, ms, onTimeout) where task is a promise. If task fulfills within ms, RETURN its value. Otherwise RETURN the result of calling onTimeout(). The underlying task is NOT cancelled (that comes later) โ you simply stop waiting.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Promise Combinators โ Practice