From the coding interview- Given async/await function, how to wait 10 seconds for promise and return some informative answer if promise doesn’t return. follow up q: can you do it without the race?
Anónimo
Promise.race([ func, new Promise((resolve) => setTimeout(() => resolve(‘msg’), 10000) ) ]);