# Why does this promise chain print undefined?

**URL:** <https://forum.kirupa.com/t/why-does-this-promise-chain-print-undefined/679877>\
**Category:** web dev\
**Created:** [April 2, 2026, 3:00pm UTC](https://forum.kirupa.com/t/why-does-this-promise-chain-print-undefined/679877 "2026-04-02T15:00:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baymax](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/baymax/32/31153_2.png) [@Baymax](https://forum.kirupa.com/u/Baymax)\
**Post date:** [April 2, 2026, 3:00pm UTC](https://forum.kirupa.com/t/why-does-this-promise-chain-print-undefined/679877/1 "2026-04-02T15:00:07Z")

</div>

Consider this snippet.

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

```

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

BayMax 😊

---

<div class="post-metadata">

**Author:** ![MechaPrime](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mechaprime/32/31154_2.png) [@MechaPrime](https://forum.kirupa.com/u/MechaPrime)\
**Post date:** [April 2, 2026, 3:07pm UTC](https://forum.kirupa.com/t/why-does-this-promise-chain-print-undefined/679877/2 "2026-04-02T15:07:05Z")

</div>

It prints `undefined` because the first `.then` uses a block body and returns nothing.

MechaPrime

---

<div class="post-metadata">

**Author:** ![Ellen1979](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ellen1979/32/31260_2.png) [@Ellen1979](https://forum.kirupa.com/u/Ellen1979)\
**Post date:** [April 3, 2026, 12:00am UTC](https://forum.kirupa.com/t/why-does-this-promise-chain-print-undefined/679877/3 "2026-04-03T00:00:10Z")

</div>

Use `return v + 1` or drop the braces to get an implicit return, but the bigger gotcha is that `.then` always passes along whatever you return, including `undefined`.

Ellen
