Cash Register - How could I improve?

Hi all,

I’ve completed the JavaScript project, “Cash Register”, and would like some feedback. I’m happy that I was able to get everything to pass, but felt, at times, like I was doing a fair amount of “MacGyer-ing”. Along the way, I tried to clean things up while keeping everything functional. In any case, I’d appreciate feedback on:

  1. How intelligible my code is to someone looking at it for the first time, and
  2. Any major pitfalls I may have stepped into while still keeping the tests passing.

Here’s a link to my

Thank you, FCC community!

These aren’t so good:

  • 80 lines long function
  • bad indentations
  • unnecessary comments
    • ideally, let your code describe the algorithm
    • if this isn’t possible, describe the algorithm in the comment rather than what each line does
    • describing what each line does is for tutorial purposes only or for clarifying hacks.
  • two step change deduction logic
    • you don’t really have to subtract unit denom value one at a time.

Thank you for the feedback! I definitely was focused on getting everything working, and did not do much to minimize lines/comments at the time. So, this will be something I revisit and try to improve. Thanks again.