Functions used to handle promises are named code example
Example 1: javascript promises
var promise = new Promise(function(resolve, reject) {
if () {
resolve("Stuff worked!");
}
else {
reject(Error("It broke"));
}
});
promise.then(
function(result) { },
function(error) { }
);
Example 2: promise chaining
new Promise(function(resolve, reject) {
setTimeout(() => resolve(1), 1000);
}).then(function(result) {
alert(result);
return result * 2;
}).then(function(result) {
alert(result);
return result * 2;
}).then(function(result) {
alert(result);
return result * 2;
});