Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • I'm learning a lot looking through this, thank you so much! I get super lazy with scope sometimes, but actually seeing this makes it pretty clear that it will save me a lot of work in the long run if I just commit to it. Super excited to take this in stride and improve off it :D

  • A for effort, but reserving my judgement because it's a bit of a tangled spaghetti, well, mess.

    I've forked my solution to show cleaned up tests, with some comments. Read and learn! Your current tests probably work because no existing solutions were invalidated, but if you do want to clean up some, write your own code. I tested what I wrote against my own solution only. I don't think there are bugs. :P

    ( The lack of let and const is most likely to bite you in the long run. If you take away one thing from it, please let it be that. )

  • Gotcha, thanks for the advice! I wasn't expecting this to gain any traction at all, so ratings weren't exactly something I was concerned over in the first place haha.

    It's a first kata and I've thankfully learned from it, so I'll just take what I can moving forward and improve =]

    Oh also random test cases are in there now lol

  • Returning inconsistent data types is not a best practice.

    In this case, it's just cute; normally, special cases often call for either an Error to be thrown or a special value of the consistent type that can never result from valid calculation ( -1 for an Int that should have been unsigned is close to the edge already ).

    Don't worry too much 'bout it - strongly typed languages have sum types for this, so translations are not impossible. But if you're going to return a string for money below zero, you may as well ask for "a week of desserts, doing the dishes, your car keys, your clothes and your dignity". :yum:

  • Ah, good on you. :]

    Unfortunately, you've been collecting bad ratings already, and not all of those people may come back to change their vote if and when you republish with random tests.

    You really need to get most everything right straight off the bat to have your kata survive let alone thrive, and having random tests is a mostly quite unavoidable part of that. The bar for creating kata is much, much higher than for solving kata; that's just the way it is.

    Happy coding! ^^

  • In the process of doing so! I published so I could show one of my co-workers katas as a proof of concept, but I didn't realize I could do that while it was still being developed. I'm adding random tests as we speak.

  • In the process of doing so! I published so I could show one of my co-workers katas as a proof of concept, but I didn't realize I could do that while it was still being developed. I'm adding random tests as we speak.

  • Sigh. It's your first kata, isn't it?

    Did you read available documentation?

  • No random tests.