Ad
  • Custom User Avatar

    Chess grid is not part of input, and you do not have to build it.
    You do not need the whole board to solve this kata.

  • Default User Avatar
  • Custom User Avatar

    [...] an issue of how the codewars editor handles the code

    I am not sure what it would mean. What kind of incorrect handling would the editor do?

    it seems it might be calling the arr.join method twice when you try to log it before the return. Maybe the tests are doing the same to it

    I have some problems understanding what "it" would be, but tests are not doing anything to anything, other than invoking your solution and comparing it with an expected answer.

    BTW, some tests that fail here pass in repl.it. Also all the tests I've done pass in VSCODE with live server, Also my code passes on w3schools editor, and at Code Playground.

    It's difficult for me to believe. Your code does indeed not solve the task of the kata correctly, and there's no chance it would pass tests anywhere else, unless they are not exhaustive enough and test only some subset of scenarios. It's enough to study sample tests to notice what's the difference between your results and expected results.

    Focus on sample tests, especially on the test case with input of "AWUBWUBWUBBWUBWUBWUBC", see what your solution returns, what is expected answer, and what it returns in other editors.

  • Custom User Avatar

    I told you, the first test passes, the second one doesn't, and it won't pass in any editor, your code doesn't replace multiple WUBs with only one space. Try using something like this to see it: http://pythontutor.com/javascript.html#mode=edit

  • Custom User Avatar

    Your code is wrong, and it fails in repl.it too.
    If you add a console.log(arr) before the return line, you'll see this: ['A', '', '', 'B', '', '', 'C']

    When your code returns undefined, you console.log the first test, which works and shows you a single space between letters, when you return, the second test fails.

    Not a kata issue.