← Back to challenges

Which Promise Resolves Faster?

JavaScriptHardnumbersvalidation

Instructions

Given two promises, create a function to determine whether the second promise is faster than the first. If it is, return true. Otherwise, return false.

Examples

speedTest(promise1, promise2) ➞ true
// promise2 resolves faster

speedTest(promise1, promise2) ➞ false
// promise1 resolves faster

Notes

  • Make sure you await both promises when executing them.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.