Cash Register - help with for loop?

Hi all,

I’ve been working on this project on and off for over a week and have got it passing some of the tests. But the for loop portion beginning on line 6 is not working correctly to count out change and return it as an array.

Can anyone point me in the right direction?

Thanks very much! :pleading_face:

for (let i = slots.length - 1; i < -1; )

slots.length - 1 is equal to 8. So, setting i equal to 8 initially and then applying the rules of your loop to values of i less than -1 (i < -1) is problematic. Also, what are you planning to do with i? Count up or count down?

LOL! What a dumb mistake, thank you for noticing. I plan to count down from the $100 bills, since when you give change, you use the largest possible units. But I put the i-- conditions inside of the function. Does it make sense to you otherwise?
(I made a few additional changes just now.)