Browser support

*Gecko 24 has an experimental implementation of Promise, under the initial name of Future. It got renamed to its final name in Gecko 25, but disabled by default behind the flag dom.promise.enabled. Even when this flag is enabled, some methods are still not supported, such as Promise.all() (as of Firefox 28)

Usage

Remember, the point of promises is to give us functional composition and error bubbling in the async world. They do this by saying that your functions should return a promise, which can do one of two things:

Promise.race

Promise.race(
[createUser('hulk'), createUser('chuck'), createUser('mr_t')]
).then(function(val) {
console.log(val);
}).catch(function(error) {
console.log(error);
});
/*
Logs: "User hulk successfully created"
All of the Promises in the array get called, but only the first value returned gets passed to .then() or .catch()
*/