I’m doing the Exact Change exercise. All the tests are complete except one, and for this particular one case my code does crasy thing. After executing line 26 it changes value. This is the line:

toGive[toGive.length-1][1] += value[i][1];

It should add the value to toGive array, how can it increase the value? Value is constant in my case, I do not want to change it in any case.

If you have any ideas why it might happen, please let me know.

```
function checkCashRegister(price, cash, cid) {
var value = [["PENNY", 0.01], ["NICKEL", 0.05], ["DIME", 0.1], ["QUARTER", 0.25], ["ONE", 1], ["FIVE", 5], ["TEN", 10], ["TWENTY", 20], ["ONE HUNDRED", 100]];
var change = Math.round((cash - price)*100)/100;
var toGive = [];
function findSum (arr) {
var sum = 0;
for (var i=0; i<arr.length; i++) {
sum += arr[i][1];
}
return Math.round(sum*100)/100;
}
if (change == findSum(cid)) {
return "Closed";
}
for (i = value.length-1; i >= 0; i--) { //loop through bills of cid from big to small
if (value[i][1] <= change) { //if the bill is smaller than what we have to give back
if (cid[i][1] > 0) { //if this bill is available in cid
cid[i][1] -= value[i][1]; //remove the value of that bill from cid
change -= value[i][1]; //remove the value of that bill from what is left to return
if (toGive.length > 0 && toGive[toGive.length-1][0] === value[i][0]) { //if the bill is already in toGive array
toGive[toGive.length-1][1] += value[i][1]; //add to the amount THIS LINE CHANGES VALUE
} else {
toGive.push(value[i]); //otherwise add it there
}
i++;
}
}
}
if (change > 0) {
return "Insufficient Funds";
} else {
return toGive;
}
}
```