Ad
  • Custom User Avatar

    Thank you so much for this comment! I was utterly confused when:

    • The test header said "Should return -1"
    • The actual output suggested the expected result was []
    • The input seemed to be 2 based on console logging (which was already tested further up and handled correctly)

    I would've never been able to guess a non-integer was the problem based on the information made available to me by the test. Bad form.

  • Custom User Avatar

    I would add more descriptive test cases result messages. I lost 20min not understanding the 4.5 case, test result description 'should return -1' I just didn't know what was the problem, wrong input should return empty array as it is written in the kata task. Message should tell me the test case and valid solution imho. for example 'Wrong result, 4.5 should return: []' instead of plain 'should return -1'. In JS there is only 'number' type not int or float. Had to add this specific check.

  • Custom User Avatar

    YI have spent a night thinking of it and you are totally right, I'll check if there is a way to implement TS type checking in tests. I'll start with translating other katas to TS and then redo this one, thank you. Ommiting types with any shouldn't be allowed.

  • Custom User Avatar

    (I see you actually made your solution generic. It should have been enforced in the tests. Not actually sure it's possible... but if it is, that has to be part of the specificiations, loud and clear, otherwise the code won't compile until it's complient, meaning the user won't have any proper feedback until he actually pass the kata. Which is a bad UX)

  • Custom User Avatar

    Hi,

    • The types aren't consistent at all: it shouldn't be allowed to declare a node without value
    • using any for the values is just.... bad? The first interest in using type is... types values! => the class should be generic
    • the description is far from complete:
      • types used as value? (the sample tests makes think that number only are used)
      • default value for next? (not said, not provided, not tested)

    cheers

    PS: I doubt implementing other data kinds will be more interesting. What you could do on the other hand is translate existing kata about all this in TS, rather than create new ones in TS only.

  • Custom User Avatar

    maybe doubly linked list hasn't been done before, you could check and perhaps make a series about that instead

  • Custom User Avatar

    Searching for "linked list" yields 26 results, and these are only the katas which mention it in the title. I'm pretty sure something as basic as creating a linked list class has been done already, possibly multiple times.

  • Custom User Avatar

    Thnak you for feedack. Making a collection of creating Nodes, LinkedList and adding more methods/functionality to it would be a bad idea?

  • Custom User Avatar

    Declaring and assigning variables is not a novel or interesting kata idea.

  • Custom User Avatar

    I was thinking about the same solution, but on every iteration you calculate calcValue(max). So I left the idea behind. althou I was thinking about passing object with { bestWord, bestScore }, but yea.. it think it would complicate readabilty.

  • Custom User Avatar

    That's not an imporvement IMO. Best practices says to do what you suggest to ensure that it strongly equates or does not equate to that.

    https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons

    The strict equality operator (===) behaves identically to the abstract equality operator (==) except no type conversion is done, and the types must be the same to be considered equal.
    
  • Custom User Avatar

    Thanks, haven't thought about that.

  • Custom User Avatar

    Only improvement possible: use !== instead of != as both arguments are numbers.

  • Custom User Avatar

    Realy nice kata. Enjoyed it and learned someting about my programing language of choice. From both kata and solutions. Recomend to get to know ord() and chr().