PromiseA().then(function(dataA){
if (dataA.foo == "skip me")
return ?? //break promise early - don't perform next then()
else
return PromiseB()
}).then(function(dataB){
console.log(dataB)
}).catch(function (e) {
//Optimal solution will not cause this method to be invoked
})
Bagaimana kode di atas dapat dimodifikasi agar rusak lebih awal (lewati kode ke-2 lalu())?
throw new Error("please catch me");
. Ini terlihat seperti duplikat. - person Shanoor   schedule 09.05.2016return { then: function() {} };
- person Martin   schedule 27.07.2017