Javascript – Sequence of rejected promise with Promise.reject()
I am learning microtask queue and i have a simple question. With the following code: Promise.resolve().then(()=>console.log("Resolved1 Promise")); Promise.reject().then(()=>console.log("Resolved2 Promise")).catch(()=>console.log('Rejected2 Promise')); Promise.resolve().then(()=>console.log("Resolved3 Promise")); Promise.resolve().then(()=>console.log("Resolved4 Promise")); Promise.resolve().then(()=>console.log("Resolved5 Promise")); I expected output to be in the sequence: Resolved1 Promise Rejected2 Promise Resolved3 Promise…