FreeCodeCamp Exact Change

The cid’s values are differentes from the value of what the code should return.
For example in the cid given the Quarter=4.25 and the return value should be Quarter=0.50.
Can anyone help me how it work?

> checkCashRegister(19.50, 20.00, [[“PENNY”, 1.01], [“NICKEL”, 2.05], [“DIME”, 3.10], [“QUARTER”, 4.25], [“ONE”, 90.00], [“FIVE”, 55.00], [“TEN”, 20.00], [“TWENTY”, 60.00], [“ONE HUNDRED”, 100.00]]) should return [[“QUARTER”, 0.50]].

Since you haven’t linked the challenge, I can only guess you’re reading it wrong. 20 - 19,5 = 0,5 and the largest coin for that is two quarters.

The cash in drawer array (the third argument) shows how much total cash the cash drawer has of a certain denomination. In the example you gave, it has $1.01 in pennies or 101 pennies, $2.05 in nickels or 41 nickels, and so on.

The value you’re supposed to return should follow the same pattern. In the example you gave, it wants you to return 50 cents in change. The largest denomination you could use would be quarters ($0.25), so to cover the change you would use $0.50 worth of quarters, or two quarters.

If the amount of change it wanted was 51 cents, you would use two quarters (2 * $0.25) and a penny (1 * $0.01) and so it would want you to return [["QUARTER", 0.50], ["PENNY", 0.01]]

Hopefully that’s clearer