1-

  1. <script>
  2. Promise.resolve(10).then(res=>{
  3. console.log(10);
  4. }).catch(()=>{
  5. console.log(20);
  6. }).then(()=>{
  7. console.log(30);
  8. throw "error"
  9. }).then(()=>{
  10. console.log(40);
  11. })
  12. </script> //10 30

2-

  1. <script>
  2. Promise.resolve().then(()=>{
  3. console.log(1);
  4. throw "error"
  5. }).catch(err=>{
  6. console.log(err);
  7. }).catch(()=>{{
  8. console.log(3);
  9. }}).then(()=>{
  10. console.log(4);
  11. })
  12. </script> //1 error 4