Ad
  • Custom User Avatar

    Maybe, instead of thinking how to change the function without changing the function, start thinking about why and how the unittest fails in the first place. This will help you come up with a solution.

  • Custom User Avatar

    The whole point of the Kata was to show that you can in fact change the behavior of the function from outside using JavaScript.

    But you need to take a few steps back and think about how JavaScript actually works and which peculiarities it has. The function looks simple, but how does JavaScript execute it actually?

    I do not want to give too many clues. If you can't come up with a solution, simply skip it.

    Just be aware that in real life as a programmer you sometimes also have such "mysteries" where you think "it can't be", until finally you understand that you overlooked something that is important that might influence the behavior of your program. Or something that you simply never knew or imagined your programming language or library would do under the hood.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The main problem here is that Codewars does not indicate which JavaScript version the katas and solutions target.

    There is also no indication how old this kata and the solutions are, in fact they are from a time when fat arrows and other modern constructs were not yet available in JavaScript.

    Another problem is that there is no indication whether the solution should be optimized for speed or for readability.

    If the lists are very small and the function is not used frequently, a simple and readable solution might be preferred over an optimized and faster one.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Looks like you start to recognize the whole vanity of life...

  • Custom User Avatar

    Would still consider this a pretty obvious and readable Python solution, not a "clever hack" and not in any way terrible.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Even JavaScript and other languages used in Code Wars have evolved and now have features that were not available 5 years ago.

    Also note that this is all work by volunteers. If anybody wants to create a new kata with a better description or tests, please go ahead. Or try to convince the author with positive criticism and friendly feedback. Personally I don't feel motivated to go back to what I posted years ago and put time and efford in changing it or adapting it to new standards, if all I get are snarky comments that "the description is a mess" and what is missing as feedback.

    Also keep in mind that in a real developer's life problem descriptions are much less complete and exact, often misleading, often formulated by people coming from different domains who think very differently from you. I don't think katas should treat people with velvet gloves and make the path too smooth and straight forward, but give people something to think and experiment, that they can apply in real life as well.

    Keep cool and don't make a drama out of everything. There will be always katas that you don't get or don't like but are fun and helpful for others. I like the diversity and have no problem with some mixed quality.

  • Loading more items...