Есть цепочка промисов. Объясните, пожалуйста, почему в консоли выводится 6, 340, а не 6, 14, 44, 94, 100? Где я ошибаюсь?
Promise.resolve(1) //promise fulfilled, value = 1
.then((x) => x * 2) //promise fulfilled, value = 2
.then(
(x) => x * 3,
(x) => x + 5
) //promise fulfilled, value = 6
.catch((x) => x + 10) //promise fulfilled, value = 6
.then((x) => {
console.log(x); //6
return x + 1;
}) //promise fulfilled, value = 7
.then((x) => {
throw x * 2;
}) //promise rejected, value = 14
.then((x) => x * 4) //promise rejected, value = 14
.then(
(x) => x + 1,
(x) => x + 3
) //promise rejected, value = 14
.catch((x) => {
console.log(x); //14
throw x + 30;
}) //promise rejected, value = 44
.catch((x) => {
console.log(x); //44
throw x + 50;
}) //promise rejected, value = 94
.then((x) => x * 20) //promise rejected, value = 94
.catch((x) => {
console.log(x); //94
return x + 3;
}) //promise fulfilled, value = 100
.then((x) => {
console.log(x); //100
});
console.log(6, 14, 44, 94, 100);