Exploring The Power of Promise Chaining and came across this code snippet:
Promise.resolve(123)
.then((res) => {
console.log(res); // 123
return 456;
})
.then((res) => {
console.log(res); // 456
return Promise.resolve(123); // Pay attention to the fact that we are returning a
Promise
})
The first function callback does not return a promise, while the subsequent ones do. Is it possible to call then
after the statement
.then((res) => { console.log(res);return 456;})
is executed?