-
-
Save conanak99/94dccdd66207c9ea21b34e4461d15516 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Khi một function bị lỗi, promise bị reject (thất hứa) | |
function chở_gái_vào_hotel() { | |
return Promise((response, reject) => { | |
reject("Xin lỗi hôm nay em đèn đỏ"); | |
}); | |
} | |
xin_mẹ_mua_xe | |
.then(chở_gái_đi_chơi) | |
.then(chở_gái_vào_hotel) | |
.then(function() { /*Làm gì đó, ai biết*/ }) | |
.catch(function(err) { | |
console.log(err); //"Xin lỗi hôm nay em đèn đỏ" | |
console.log("xui vl"); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment