Promise
API overview
new Promise()
requires a function as param
resolving a promise
via constructor parameter new Promise((resolve) => { resolve(); })
using Promise.resolve()
a rejected promise
using the constructor parameter
via Promise.reject()
Promise.all()
Promise.all([p1, p2])
resolves when all promises resolve
Promise.all([p1, p2])
rejects when a promise is rejected
Promise.race()
Promise.race([p1, p2])
resolves/reject when one of the promises resolves/rejects
Promise.race([p1, p2])
rejects when one of the promises rejects
Promise.race([p1, p2])
order matters (and timing)
Required Knowledge
Related Katas
Promise
- basics
- creation
- chaining
then()
- the API
promise.catch()
Difficulty Level
INTERMEDIATE
First Published
15 March 2015
Stats
10 tests to solve