Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active June 22, 2016 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/71651ac83a12cd0385217a194d033a48 to your computer and use it in GitHub Desktop.
Save conanak99/71651ac83a12cd0385217a194d033a48 to your computer and use it in GitHub Desktop.
// Dùng callback hell
xin_mẹ_mua_xe(function(xe) {
chở_gái_đi_chơi(xe, function(gái) {
chở_gái_vào_hotel(hotel, function(z) {
// Làm gì đó, ai biết
});
});
});
// Dùng promise, code gọn nhẹ dễ đọc
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*/ });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment