# During my 2 numbers is not as desired; who can help me fix it

Tell us what’s happening:
Describe your issue in detail here.

``````**Your code so far**
``````
``````
for(var i = 0; i < arr.length; i++) {
for(var j = 0; j < arr.length; j++) {
if(arr[i] === arr[j]) {
arr[i][1] += arr[j][1];
arr.splice(j, 1);
}
}
}
return arr;
}

function checkCashRegister(price, cash, cid) {
var cid = cid.reverse()
var change = cash - price;
// console.log(change)
var cidTotal = 0;
for (var i = 0; i < cid.length; i++) {
cidTotal += cid[i][1];
}
if (cidTotal < change) {
return {
status: "INSUFFICIENT_FUNDS",
change: []
};
} else if (cidTotal === change) {
return {
status: "CLOSED",
change: cid.reverse()
};
} else {
var changeArr = [];
var currency = [
["ONE HUNDRED", 100.00 ],
["TWENTY", 20.00],
["TEN", 10.00],
["FIVE", 5.00],
["ONE", 1.00],
["QUARTER", 0.25],
["DIME", 0.10],
["NICKEL", 0.05],
["PENNY", 0.01]
];
for (var j = 0; j < currency.length; j++) {
while (cid[j][1] > 0 && change >= currency[j][1]) {
change -= currency[j][1];
cid[j][1] -= currency[j][1];
// console.log("so tien: " + change)
console.log(change + "-" + cid[j][1])
changeArr.push(currency[j]);
}
}
return {
status: "OPEN",
}
}
}

console.log(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; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.84 Safari/537.36`

Challenge: Cash Register