how to write promise object 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 */ }
);