Tell us what’s happening:
Trying to do this last challenge and I noticed a weirdity. Can someone explain why when javascript adds together 1.01 and 2.05 it equals 3.0599999999999996?
I checked in another javascript playground and the same thing happens. Is it something wrong with the actual JS code?
Your code so far
function checkCashRegister(price, cash, cid) {
console.log(1.01 + 2.05)
}
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/116.0.0.0 Safari/537.36
Challenge: JavaScript Algorithms and Data Structures Projects - Cash Register
Link to the challenge: