Spot the bug in seat reservation

from Code prompt vocabulary
Node 24 beginner 5 min 3 issues to find

Find the contract failures in this generated reservation function.

JavaScript
function reserveSeats(inventory, requested) {
  if (!requested) return inventory;
  inventory.available -= requested;
  if (inventory.available < 0) {
    console.log("not enough seats");
  }
  return inventory;
}
Open in playground
Report an error