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

  • Custom User Avatar

    Thank you. Is there really a 7 kyu level question? I must really suck with Objects then. I cannot seem to get this... Time to move on for now.

  • Custom User Avatar

    Gotta admit, I am lost in the sauce here. I saw the hint and looked up defineProperty but I still don't get it. I am horrible with objects like this. Any advice for better understanding definProperty and how it can be used to make dynamic properties?

  • Custom User Avatar

    Got it, thanks again!

  • Custom User Avatar

    Holy crap I didn't even think of apostrophies! Thanks.

  • Loading more items...