Cash Register (Need Help)

function checkCashRegister(price, cash, cid) {
// Step 1: determine what the value of the change will be  
  let change = cash - price;
// Step 2: add up all the cash-in-drawer 
for (let i = 0; i < cid.length; i++) {
  // add up all the values in cid[1] of each array
}
// Step 3: if cash-in-drawer is less than change
  if (cid < change) {
    return {status: "INSUFFICIENT_FUNDS", change: []};
  }
  // Step 4: if cash-in-drawer is equal 
  if (cid === change) {
    return {status: "CLOSED", change: [   ]}; 
  }
  // Step 5: if cash-in-drawer is greater than change return status as open with the amount of change that is due
  if (cid > change) {
    return {status: "OPEN", change: [   ]};
  }
}

console.log(checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]));

Can someone help me out a little bit? Are my steps off? Am I going about this correctly? I feel a bit lost with what to do for steps 2 and 5

Nevermind figured it out

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.