Why does this promise chain print undefined?

Simple async question.

Promise.resolve(1)
  .then((v) => { v + 1; })
  .then((v) => console.log(v));

Why does this print undefined, and what one-line change fixes it.

WaffleFries

Because the first .then() does not return anything, the next step gets undefined.

BobaMilk

Yep - if a .then() callback doesn’t return, it resolves as undefined, so the next .then() receives undefined.

WaffleFries