I need help with the last two tests on the cash register project

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cash Register</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<input id="cash"></input>
<div id="change-due"></div>
<button id="purchase-btn">Purchase</button>
<script src="script.js"></script>
</body>
</html>
#purchase-btn {
  background-color : orange; 
}
let price = 19.5;
let cid = [
["PENNY", 1.01],
["NICKEL", 2.05],
["DIME", 3.1],
["QUARTER", 4.25],
["ONE", 90],
["FIVE", 55],
["TEN", 20],
["TWENTY", 60],
["ONE HUNDRED", 100]
];

const cash = document.getElementById("cash");
const change = document.getElementById("change-due");
const purchaseButton = document.getElementById("purchase-btn");

let currencyUnits = [
["PENNY", 0.01],
["NICKEL", 0.05],
["DIME", 0.1],
["QUARTER", 0.25],
["ONE", 1],
["FIVE", 5],
["TEN", 10],
["TWENTY", 20],
["ONE HUNDRED", 100]
];

purchaseButton.addEventListener("click", () => {
const cashValue = parseFloat(cash.value);
const changeDue = cashValue - price;

if (cashValue < price) {
alert("Customer does not have enough money to purchase the item");
return;
}

if (cashValue === price) {
change.innerText = "No change due - customer paid with exact cash"
return;
}

const changeResult =getChange(changeDue, cid);

if (changeResult.status === "INSUFFICIENT_FUNDS" || changeResult.status === "CLOSED") {
  change.innerText = `Status: ${changeResult.status} ${formatChange(changeResult.change)}`
} else {
  let changeText = `Status: OPEN ${formatChange(changeResult.change)}`;
  change.innerText = changeText
}


});

const getChange = (changeDue, cid) => {
let totalCid = parseFloat(cid.reduce((sum, [_,amount]) => sum + amount, 0).toFixed(2))
if (totalCid < changeDue) {
  return { status: "INSUFFICIENT_FUNDS", change: [] }
}

let changeArray = [];
let remainingChange = changeDue;

for (let i = currencyUnits.length - 1; i >= 0; i--) {
  let unit = currencyUnits[i][0];
  let unitValue = currencyUnits[i][1];
  let unitInDrawer = cid[i][1];

  if (unitValue <= remainingChange && unitInDrawer > 0) {
     let amountFromUnit = 0;

     while (remainingChange >= unitValue && unitInDrawer > 0) {
       remainingChange = (remainingChange - unitValue).toFixed(2);
       unitInDrawer -= unitValue;
       amountFromUnit += unitValue;
     }

     if (amountFromUnit > 0) {
       changeArray.push([unit, amountFromUnit])
     }
  }
}

if (remainingChange > 0) {
  return { status: "INSUFFICIENT_FUNDS", change: [] }
}

if (changeDue === totalCid) {
  return { status: "CLOSED", change: cid }
}

return { status: "OPEN", change: changeArray }

} 

const formatChange = changeArray => changeArray.map(([unit, amount]) => `${unit}: $${amount.toFixed(2)}` ).join(" ");

I don’t understand what they are asking me, whenever I try adding the code to fix it, it ends up messing up the other tests. I reassigned the variables and it looked as if it already worked so I don’t know if I’m doing something wrong or if my project is just buggy.

try to add the code I wrote in this post at the end of your editor. I can’t check myself, but maybe it will help you

Test 18 is " the value in the #change-due element should be "Status: CLOSED PENNY: $0.5" ." But I get “Status: CLOSED PENNY: $0.50 NICKEL: $0.00 DIME: $0.00 QUARTER: $0.00 ONE: $0.00 FIVE: $0.00 TEN: $0.00 TWENTY: $0.00 ONE HUNDRED: $0.00”. Is this still not right? If not, I don’t know how to get rid of all the other values that aren’t needed. As for test 19, am I not already doing that?

yeah, you need to have only values that are different from 0

where do I learn to do that? is there a specific syntax I could use?

You should have learned some way to do this with all of the lessons you’ve done up until here. You need to think strategically (not about syntax) about the tools you have and how you can achieve this outcome.

Do you need to have another function? Do you need to remove 0 values from the array before you return it?