Reputation: 1
I am currently completing the JavaScript project course of freeCodeCamp.org. Now I have these two steps I can't really pass through:
Failed: 18. When price is 19.5, the value in the #cash element is 20, cid is [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]], and the #purchase-btn element is clicked, the value in the #change-due element should be "Status: CLOSED PENNY: $0.5".
Failed: 19. When price is less than the value in the #cash element, total cash in drawer cid is equal to change due, and the #purchase-btn element is clicked, the value in the #change-due element should be "Status: CLOSED" with change due in coins and bills sorted in highest to lowest order.
I believe the issue on step 18 is on the calculateChange
function, but I can't determine what specifically it is.
here is my whole code: codepen - source code
If you want to check the specific project link in freeCodeCamp and try to reproduce my code in there, here is the link: freecodecamp.org - build a cash register project
Upvotes: -6
Views: 27