Ad
  • Custom User Avatar

    Closing.

  • Default User Avatar

    'looks like you've solved it'

  • Custom User Avatar

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

  • Default User Avatar

    Not an issue

  • Default User Avatar

    You should return instead of console.log. Always assume you should return the answer because AFAIK, CodeWars doesn't read from console ever.

  • Default User Avatar

    You should always assume you should be returning the value because CodeWars doesn't read from the console ever, AFAIK.

  • Custom User Avatar

    Your value needs to be returned, not logged out. Though upon my review, I did not see that having to return the value was included in the description. So, +1 for adding that to the description.

  • Default User Avatar

    Just note that with the answer by @the-code-less-traveled it matches both letters and numbers (not just letters as s/he specified on the last line).

  • Custom User Avatar

    This is mostly right but I would like to offer a couple of small corrections:

    * Means to match the preceding expression zero OR MORE times. In this case where it follows '.' it allows for any number of random characters.

    \1 Refers back to your match for the last expression in parentheses. In this case this means the character that matched '(\w)'.

    In total '(\w).*\1' equates to: An alphanumeric character, '\w', followed by any number of random characters, '.*', followed by the same alphanumeric character again, '\1'

  • Custom User Avatar

    Hi PantlessBandit! I'm going to try to explain this since I just got finished looking up how this works.
    What chunjef created is known as a regular expression, or regex for short. Regular expressions are a way to describe an analyze string data.
    Regular expressions use forward slashes to encapsulate what it is we're looking for in the string.
    \w (with a lower case w) means to look for an alphanumeric character
    . represents all other characters while * means zero instances
    What this means is to leave all the other characters alone like digits.
    Finally the 1 means that there should be only 1 instance of each letter.
    The i makes the data analysis case insensitive
    The ! means NOT
    So, to put it all together
    Test the string to see if any LETTER (not other characters) does NOT appear more than once.

    I hope I explained that right. I just finished learning about it here:
    http://eloquentjavascript.net/09_regexp.html#p_uNMQxzr01n

  • Custom User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

    Your code counts "I'm" as two separate words. It's one word. Same for other non alphabetic charcters.
    Also, You can use console.log to print the arguments to your function. It would make finding bugs much easier.

  • 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

  • Loading more items...