Build a Cash Register - Tests don't validate something that works

My code completely accomplishes the tasks of " When the value in the #cash element is less than price , an alert should appear with the text "Customer does not have enough money to purchase the item" ." and " Failed:When the value in the #cash element is equal to price, the value in the #change-due element should be "No change due - customer paid with exact cash"." within the Build a Cash Register program, but the testing doesn’t pick up on it. I’ve tried different methods of completing these tasks, but nothing works. Does anyone know what to do? I think it has to do with my javascript.

let price = 1.87;
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]
];


var cash = document.getElementById("cash");


cash.addEventListener('input', () => {
  // Log the new value after an input is made
  if (document.getElementById("cash").value == price) {
    document.getElementById("change-due").innerHTML = "No change due - customer paid with exact cash";
  }

  if (document.getElementById("cash").value < price) {
    window.alert("No change due - customer paid with exact cash");
  }
});

Check that the window alert has the correct text in it.
also, don’t use ‘input’ as the event type. That event will trigger whenever the value changes in the input field, not when you intend to submit.
Add the event listener to a button with the id “purchase-btn” as per the instruction and let the event type be ‘click’.

Hi @jhaas0953

Your code is setting cid in the global scope.
Each time the code runs, it is starting from the last known value, instead of starting from the initial value.

Happy coding