Create three methods fetchOne
, fetchTwo
and fetchThree
which will return promises.
The promises should resolve after 200ms, 300ms and
600ms respectively.
Additionally, write a method fetchWithTimeout(fetchFunctions, timeLimit)
.
If all promises returned by the methods in the fetchFunctions
resolve within timeLimit
, the method should resolve with the message Success. Otherwise, it should
reject with Operation timed out.