Spot the bug - #139: Inventory Ledger

Why is my wizard shop displaying property names instead of values?

const potionInventory = {
  healingDraught: 15,
  manaElixir: 8,
  invisibilityBrew: 3,
  dragonTears: 1
};

function formatStockReport(stock) {
  const reportLines = [];
  const entries = Object.keys(stock);

  for (let i = 0; i < entries.length; i++) {
    const [item, count] = entries[i];
    const label = item.replace(/([A-Z])/g, ' $1').toLowerCase();
    reportLines.push(`${label.trim()}: ${count} bottles in stock`);
  }

  return reportLines.join('\n');
}

function calculateRestockCost(stock, costPerUnit = 5) {
  let totalBottles = 0;
  for (const item in stock) {
    if (Object.hasOwn(stock, item)) {
      totalBottles += stock[item];
    }
  }
  return totalBottles * costPerUnit;
}

console.log('--- Current Inventory ---');
console.log(formatStockReport(potionInventory));
console.log(`Estimated restock budget: $${calculateRestockCost(potionInventory)}`);

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