Spot the bug - #185: Potion Stat Mixer

Why is this potion mixer clobbering base stats?

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.

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.