Exact change challange

Trying to solve the challange, and there is an issue with result, I think there is a mistake in conditions, but can’t figure out it…

for(var i=1;i<cid.length;i++) {
    val=0;
    while(cid[i][1] >= 0 && change >= den[i].value) {
      change -= den[i].value;
      change = Math.round(change * 100) / 100;
      cid[i][1] -= den[i].value;
      val += den[i].value;
      
    }
    if(val) {
      changeArray.push([den[i].name, Number(val.toFixed(2))]);
    }
  }

For this test: checkCashRegister(3.26, 100.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);,

it returns: [["TWENTY", 20.00], ["TEN", 10.00], ["FIVE", 5.00], ["ONE", 61.00], ["QUARTER", 0.50], ["DIME", 0.20], ["PENNY", 0.04]].

What is the “issue with the results”? What isn’t behaving the way you expect?

Shoud have reverse the cid array…