// make new promise ... so this object will promise us that it will hold an Asynchronous action
// some times promise resolve and some times promise get rejected
const A = new Promise((resolve, reject) => {
setTimeout(() => {
// here we pass argument if promise get resolved
resolve('Done');
// here we pass argument if promise get rejected
reject('Didn"t');
}, 3000);
});
// design handling callback function for resolve
let handleResolvedA = (massage)=>{console.log(massage)}
// design handling callback function for reject
let handleRejectedA = (massage)=>{console.log(massage)}
// do handling for both
A.then(handleResolvedA, handleRejectedA)