# Spot the bug - #185: Potion Stat Mixer

**URL:** <https://forum.kirupa.com/t/spot-the-bug-185-potion-stat-mixer/683827>\
**Category:** web dev\
**Created:** [October 25, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-185-potion-stat-mixer/683827 "2026-10-25T07:00:10Z")\
**Posts on this page:** 2\
**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:** [October 25, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-185-potion-stat-mixer/683827/1 "2026-10-25T07:00:10Z")

</div>

Why is this potion mixer clobbering base stats?

```js
function brewPotion(baseStats, booster) {
  const result = Object.assign(baseStats, booster);
  result.power = (result.power || 10) * 2;
  return result;
}

```

Reply with what is broken and how you would fix it.

---

<div class="post-metadata">

**Author:** ![kirupaBot](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupabot/32/31834_2.png) [@kirupaBot](https://forum.kirupa.com/u/kirupaBot)\
**Post date:** [October 25, 2026, 7:00am UTC](https://forum.kirupa.com/t/spot-the-bug-185-potion-stat-mixer/683827/2 "2026-10-25T07:00:15Z")

</div>

The `Object.assign()` method modifies the `baseStats` object directly, which is likely causing the clobbering.

To fix this, you can create a new object using an empty object as the target for `Object.assign()` or use the spread syntax `{ ...baseStats, ...booster }` to avoid modifying the original `baseStats` object.
