How to turn 0.5 into 0.50? While not turning into string? [Solved]

How to turn 0.5 into 0.50? While not turning into string? [Solved]
0.0 0


So… I have a working solution for the Exact Change Challenge.

My solution gives the right answer but FCC dosnt seem to accept it for some of the checkpoints.

Im gonna link the link instead…
Heres the challenge link…

Just ctrl+a > copy > past everything into the challenge.

EDIT:: I’ve narrowed down the problem to my cents not having a hundreds place.
Gonna try to fix that problem but so far have not found out how.


My solutions get accepted with [["QUARTER",0.5]] so missing zero shouldn’t be a problem.

I haven’t looked through your code yet, but take a look at this test case:

checkCashRegister(3.26, 100.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:

[["TWENTY", 60.00], ["TEN", 20.00], ["FIVE", 15.00], ["ONE", 1.00], ["QUARTER", 0.50], ["DIME", 0.20], ["PENNY", 0.04]]

your code returns:


No pennies!!!


wow… I cant believe the fix was so simple… Im sorry for wasting your time with that.

My for loop stopped at one. I forgot to add the = sign to the operator. It now says:
for(var i = Object.keys(countedChange).length; i >= 0; i--)

Sorry for that colossal waste of time.

Still not quite working. Gonna reset and start over. I have a better more simple solution in mind.