Jan-Ivar Bruaroey (2016-10-27T12:22:25.000Z)
forbes at lindesay.co.uk (2017-01-08T01:33:35.746Z)
Likely this would be more convincing without a bug. Here is the correct wait function: ```js let wait = (ms, cancel = new Promise(() => {})) => { let id, both = x => [x, x]; cancel.then(...both(() => clearTimeout(id))); return Promise.race([new Promise(resolve => id = setTimeout(resolve, ms)), cancel]); }; ``` For caller flexibility, we want to cancel on any activity of the cancel promise, which would have been more apparent in an example that actually relied on clearTimeout working. Fiddle updated. PTAL!