Advertisement
whoisYeshua

Promise Order 2

Jun 15th, 2023
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. console.log(1)
  2.  
  3. setTimeout(() => {
  4.   console.log(2)
  5. }, 10)
  6.  
  7. setTimeout(() => {
  8.   console.log(3)
  9. }, 0);
  10.  
  11. new Promise((_, reject) => {
  12.   console.log(4)
  13.   reject(5)
  14.   console.log(6)
  15. }).then(() => console.log(7))
  16. .catch(() => console.log(8))
  17. .then(() => console.log(9))
  18. .catch(() => console.log(10))
  19. .then(() => console.log(11))
  20. .then(console.log)
  21. .finally(() => console.log(12))
  22.  
  23. console.log(13)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement