Ad
  • Default User Avatar

    The kata needs a little precision like: "You can assume that the input string s is always valid and every letter matches a password.".

    What if you give a valid string, with extra letters? Maybe part of another test...?

  • Default User Avatar

    This test has not been thought with the initial idea of discouraging JSON.parse.

    This test comes from a real case:
    I have a column of type array inside a PostgreSql table. Array's format in Postgre is exactly what we have in the test input.

    The best practice, is the one that helps you solving a specific problem efficiently. If JSON.parse can not work here, then the best idea is not using JSON.parse, but to innovate :)

  • Default User Avatar

    Where did you get this piece of information from? JS files are typically minified and gzipped anyway so this makes no sense. Not even JSstandard mentions it. It must have been some other random people conjuring up excuses without citations so they can feel justified not following the most authoritative semi-standard :P

    That's exactly my point !!!! This piece of information comes from a man on StackOverflow who agrees about this standard and made his own interpretation depending on his own experience with other developers inside a group. His argument can be valid if you don't have to minify your js file, otherwise it doesn't make any sense like we said (https://stackoverflow.com/questions/22782677/coding-style-in-javascript-why-prefer-2-spaces-not-4-spaces).

    Also, if you're coding inside CW, it also defaults to using 2 spaces as indent (backspace and opening new lines. Tabs are ignored here).

    If your standard does not give me a solid and unbeatable reason to use it, that means i can have my own, since every solution provided will have its specific standard, or no standard at all.
    I understand your point of conforming to standards, what I am trying to say is that, it's not the absolute way to do it.

  • Default User Avatar

    That's an excellent idea, thanks.

  • Default User Avatar

    Thanks, changed. In the future, I will do myself every kata i create, like a real user.

  • Default User Avatar

    Interesting result, but question, why did you use eval in this situation, instead of a function?

  • Default User Avatar

    There is only one point I agree with you is 0 spaces at the beginning, it was a copy/paste from one my file (BAD). But about your 2 spaces, the main reason this standard has been fixed is to save 4% on the file size, which does not make sense here.

    You can use 4, 2 spaces or tabs, there are no best way to do it. Even some languages like php recommends 4 spaces and no tabs. It only depends on your personal preference, and I prefer 4 spaces.

    Thank you for the suggestions :)

  • Default User Avatar

    You are right, my mistake as it is my first kata, I just changed the initial code to be the barebone structure of the function.