var firstPromise = new Promise((resolve, reject) => {
resolve('first promise');
});
firstPromise.then(() => {
return new Promise((resolve, reject) => {
resolve('second promise');
}).then((result) => {
console.log('hello');
});
}).then((result) => {
console.log(result);
});
I know this is not the best way to write this promise chain, but I was wondering why the last .then executes at all. I'm not returning anything with console.log('hello'), so wouldn't the .then off of the second promise never resolve?