Существует ли какая-либо разница между двумя следующими кодами?
myPromise.then(function() {
console.log('success');
}).catch(function() {
console.log('error');
});
myPromise.then(function() {
console.log('success');
}, function() {
console.log('error');
});
Я знаю, что then
и catch
возвращает новый promises разрешенный или отклоненный с возвратом значения в обратном вызове. Но я вижу 2 кода в Интернете, и мне интересно узнать о реальных различиях между двумя кодами.