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

    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

    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.