Tell us what’s happening:
Right now I’m just trying to get a total amount of money of the “cid” variable and i keep getting 335.40999999999997 instead of 335.41. I’ve read a few forum posts about similar problems and have tried applying the same solutions but I am still getting the same results. I think i might be applying it incorrectly but I am unsure . I would really appreciate and advice regarding this problem .
Your code so far
function checkCashRegister(price, cash, cid) {
let cid_total = 0;
for (let i in cid) {
cid_total = Number.parseFloat(cid_total + cid[i][1])
}
console.log(cid_total);
var change;
return 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]]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36
.
Challenge: Cash Register
Link to the challenge: