skip to Main Content

Javascript – Callback and Microtask Queue of Java Script

p1 = new Promise((res,rej)=>{ console.log("p1 setTimeout"); setTimeout(()=>{ res(17); }, 10000); }); p2 = new Promise((res,rej)=>{ console.log("p2 setTimeout"); setTimeout(()=>{ res(36); }, 2000); }); function checkIt() { console.log("Started"); let val1 = this.p1; console.log("P1"); val1.then((data)=>{console.log("P1 => "+data)}); let val2 = this.p2; console.log("P2"); val2.then((data)=>{console.log("P2…

VIEW QUESTION
Back To Top
Search