Cash register help pass last test

I have all, but one passing, but I can’t figure it out. Could someone tell me what I’m missing?

function checkCashRegister(price, cash, cid) {
  let change=0;
  let status;
  const CURRENCY_UNIT = [0.01, 0.05 , 0.10, 0.25, 1.00, 5.00, 10.00, 20.00, 100.00];
  const PURCHASE_PRICE = price; 
  const CASH = cash;
  let cashInDrawer = cid; 
  let difference = CASH - PURCHASE_PRICE;
 // difference=difference.toFixed(2);

  for(let i=0;i<cashInDrawer.length;i++){
    change=parseFloat(change)+parseFloat(cashInDrawer[i][1]);
  }

  if(change===difference){
    status="CLOSED";
    change=cashInDrawer;
  }else if(change<CASH){
    status="INSUFFICIENT_FUNDS";
    change=[];   
  }else{
    status="OPEN";
    change=[];
    for(let i=cashInDrawer.length-1;i>0;i--){
      let changeOut=0;
      let currentCurrencyUnit=CURRENCY_UNIT[i];
      let changeCurrencyUnit=cashInDrawer[i][1];

      console.log(difference.toFixed(2), changeOut,  currentCurrencyUnit, changeCurrencyUnit)
       while(difference>=currentCurrencyUnit){
        //console.log(difference.toFixed(2),  currentCurrencyUnit, cashInDrawer[i][1])
        difference=difference-currentCurrencyUnit;
        difference=parseFloat(difference.toFixed(2));
        console.log(difference);
        changeOut+=currentCurrencyUnit;
        console.log(changeOut);
        //changeCurrencyUnit=changeCurrencyUnit-currentCurrencyUnit; 
        console.log(difference===0, changeCurrencyUnit===changeOut);

        if(difference===0 || changeCurrencyUnit===changeOut){
          change.push(cashInDrawer[i][0], changeOut);
        }         
      }       
      
    }
    change=[change];
  }

  console.log({status, change});

  return {status, change};
}

//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]]);
//should return {status: "OPEN", change: [["QUARTER", 0.5]]}.
checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
//should return {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}.

Hey there,

which one is not passing?

This one:

checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]) should return {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}.

I have the twenties and tens to print out, but after that it doesn’t work:

function checkCashRegister(price, cash, cid) {
  let change=0;
  let status;
  const CURRENCY_UNIT = [0.01, 0.05 , 0.10, 0.25, 1.00, 5.00, 10.00, 20.00, 100.00];
  const PURCHASE_PRICE = price; 
  const CASH = cash;
  let cashInDrawer = cid; 
  let difference = CASH - PURCHASE_PRICE;
 // difference=difference.toFixed(2);

  for(let i=0;i<cashInDrawer.length;i++){
    change=parseFloat(change)+parseFloat(cashInDrawer[i][1]);
  }

  if(change===difference){
    status="CLOSED";
    change=cashInDrawer;
  }else if(change<CASH){
    status="INSUFFICIENT_FUNDS";
    change=[];   
  }else{
    status="OPEN";
    change=[];
    for(let i=cashInDrawer.length-1;i>0;i--){
      let changeOut=0;
      let currentCurrencyUnit=CURRENCY_UNIT[i];
      let changeCurrencyUnit=cashInDrawer[i][1];

      console.log(difference.toFixed(2), changeOut,  currentCurrencyUnit, changeCurrencyUnit)
       while(difference>=currentCurrencyUnit){
        //console.log(difference.toFixed(2),  currentCurrencyUnit, cashInDrawer[i][1])
        difference=difference-currentCurrencyUnit;
        difference=parseFloat(difference.toFixed(2));
        console.log(difference);
        changeOut+=currentCurrencyUnit;
        console.log(changeCurrencyUnit, changeOut, difference);
        //changeCurrencyUnit=changeCurrencyUnit-currentCurrencyUnit; 
        console.log(difference===0, changeCurrencyUnit===changeOut);

        if(changeCurrencyUnit===changeOut){
          change.push(cashInDrawer[i][0], changeOut);
          console.log(i);
          break;
        }
        console.log(i);
      }       
    }
    change=[change];
  }

  console.log({status, change});

  return {status, change};
}

//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]]);
//should return {status: "OPEN", change: [["QUARTER", 0.5]]}.
checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])
//should return {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}.