Ad
  • Custom User Avatar

    He calls the replace(). Replace accepts something called a regex (which tells your replace method to expect a certain type of string pattern -- in this case the regex is a '.' which ensures your input is any character but a line terminator). The second parameter replace accepts is a callback function. The callback function contains a dictionary of matching DNA values. This function runs on each individual character from the original dna string and 'replaces' it with the matching DNA value from the dictionary.

  • Custom User Avatar

    I'd greatly appreciate if somebody could take a look and help me figure out what I've done wrong.

    This seems to be a question, not an issue.
    Please before posting an issue look at the top of the page to see how many people passed the kata in your language (1975 for JS - I suppose Js is your language...). When the number is big enough chances are there is a problem in your code then post a question, not an issue, to see if somebody has time to look at your code.
    The first test you failed is gap(11,30000,100000) in fixed tests; this test is common to all languages (passed by 8217 people -see top of the page) so I am afraid there are some flaws in your code.
    Cheers.

  • Custom User Avatar

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

  • Custom User Avatar

    Doing it like that, you only add those properties to that particular array, you have to work with the class instead.

  • Custom User Avatar

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

  • Custom User Avatar

    That last sentence LOL.

  • Custom User Avatar

    And how did you extend it? We can't guess it. Post your code and mark your post as having spoiler content.

  • Custom User Avatar

    TypeError: numbers.square is not a function
    at /home/codewarrior/index.js:83:28
    at /home/codewarrior/index.js:89:5
    at Object.handleError

    Using Javascript. I've extended the 'numbers' array with the desired methods (square, cube, sum, average, even, odd). They run fine in my local environment and produce the expected outputs. But when I run the sample tests/attempt through the codewars platform I recieve the above error message. I'm a novice developer and don't quite understand what's happening behind the scenes but figured I'd submit the issue here for the admin to take a look at.