**Tell us what’s happening:**

I’m having trouble thinking of ways on how return the the right amount change. My return is [ [ ‘TWENTY’, 20 ], [ ‘TWENTY’, 20 ], [ ‘TWENTY’, 20 ], [ ‘TWENTY’, 20 ], [ ‘TEN’, 10 ],

[ ‘FIVE’, 5 ], [ ‘ONE’, 1 ], [ ‘QUARTER’, 0.25 ], [ ‘QUARTER’, 0.25 ], [ ‘DIME’, 0.1 ], [ ‘DIME’, 0.1 ],

[ ‘PENNY’, 0.01 ], [ ‘PENNY’, 0.01 ], [ ‘PENNY’, 0.01 ] ]. Instead I’m suppose to return 3 twenties, 2 tens, 15 fives, 1 ones, 2 quarters, 2 dimes, 4 pennies.

I think the computer doesn’t know how much each money is worth??? So, I guess I’m suppose to somehow write a code to tell how much each of them are worth??? I also iterated the “cid” argument but that also returns the wrong change amount. I can’t think of a way of knowing how to do this. Help…

**Your code so far**

```
function checkCashRegister(price, cash, cid) {
var money = [['ONE HUNDRED', 100], ['TWENTY', 20], ['TEN', 10], ['FIVE', 5], ['ONE', 1], ['QUARTER', 0.25], ['DIME', 0.10], ['NICKEL', 0.05], ['PENNY', 0.01]];
cid = cid.reverse((a, b) => b - a);
var difference = [price, cash].reduce((a, b) => b - a);
var change = [];
var sumTotal = 0;
cid.forEach(function(val, ind, arr){
sumTotal += arr[ind][1];
});
for(var i = 0; i < money.length; i++){
while(difference > money[i][1]){
change.push([money[i][0], money[i][1]]);
difference -= money[i][1];
}
}
console.log(change)
}
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]]);
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0`

.

**Link to the challenge:**

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register/