why are promises used in javascript code example
Example: promises in javascript
myPromise.then(
function(value) { /* code if successful */ },
function(error) { /* code if some error */ }
);
myPromise.then(
function(value) { /* code if successful */ },
function(error) { /* code if some error */ }
);