Why console is displaying that it should'nt show [penny,0.5] pls if you know the problem help

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

  **Your code so far**

function checkCashRegister(price, cash, cid) {
let p=cid.slice()
let change=cash - price
let result=[ [ 'ONE HUNDRED', 0 ], [ 'TWENTY', 0 ], [ 'TEN', 0 ], [ 'FIVE', 0 ], [ 'ONE', 0 ], [ 'QUARTER', 0 ], [ 'DIME', 0 ], [ 'NICKEL', 0 ], [ 'PENNY', 0 ] ]
while(change>=0.01 && cid[0][1]>=0.01){
return result

console.log(checkCashRegister(19.5, 20, [["PENNY",1], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]))

  **Your browser information:**

User Agent is: Mozilla/5.0 (Linux; Android 11; SAMSUNG SM-A125F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/14.2 Chrome/87.0.4280.141 Mobile Safari/537.36

Challenge: Cash Register

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

I suggest you watch this:

If you have any questions, please ask them

1 Like

Thanks alot i really enjoyed the video btw for the cashregister project i did the method of multiplication by 100 then dividing by 100 and it was great

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.