let num = 2;
//call back function
const promis = new Promise(function (resolve, reject) {
if (num > 5) {
//this resolve method will send data to resoleveData variable
resolve(" Problem resolved successfully")
}
else {
//this reject method will send data to rejectData variable
reject("sorry problem couldn't solve")
}
})
promis.then(
//resoleveData variable
function (resolveData) {
console.log(resolveData)
}).catch(
//rejectData variable
function (rejectData) {
console.log(rejectData)
})