Promise handle async programming, Job quee is use to handle promise.
promiseFunciton(val): Promise<any>{
return new Promise((resolve, reject)=>{
if(val ==1){
setTimeout(()=>{ resolve(1)}, 3000)
}else{
reject(2)
}
})
}
async asyncFunction(val){
let i = await this.promiseFunciton(val);
console.log("async",i)
}
----------------------
this.promiseFunciton(1)
.then((success)=>{
console.log("success")
}).catch((error)=>{
console.log("error")
});
this.asyncFunction(1);