doSomething()
.then(function(result) {
return doSomethingElse(result);
})
.catch(failureCallback);
var doSome = new Promise(function(resolve, reject){
resolve('I am doing something');
});
doSome.then(function(value){
console.log(value);
});
new Promise( (res, rej) => {
setTimeout(() => res(1), 1000);
}).then( (res) => {
console.log(res); // 1
return res*2
}).then( (res) => {
console.log(res); // 2
});
promiseObject.then(onFulfilled, onRejected);
const promise2 = doSomething().then(successCallback, failureCallback);