promise catch() and then() priority issue

even tho promise is asynchronous still it works in order by the code , but my code under works bit differently const exampleB = new Promise((res, rej) => rej('rej')) .then(res => console.log(res)) .catch(res => console.log(res)); // exampleB const exampleA = new Promise(res => res('res')).then(res => console.log(res)); // console res rej since exampleB's rejected right away it should register catch to the webapi and then example A's then () but when i check chrome deb tool, and source tab example A's then run earlier than example B's catch can someone plz explain this behavior? i dont understand since then from Promise B's shouldnt run since its rejected so its really about the chained code that matters here
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server