1-
<script>
Promise.resolve(10).then(res=>{
console.log(10);
}).catch(()=>{
console.log(20);
}).then(()=>{
console.log(30);
throw "error"
}).then(()=>{
console.log(40);
})
</script> //10 30
2-
<script>
Promise.resolve().then(()=>{
console.log(1);
throw "error"
}).catch(err=>{
console.log(err);
}).catch(()=>{{
console.log(3);
}}).then(()=>{
console.log(4);
})
</script> //1 error 4