Ad
  • Custom User Avatar

    Approved.

  • Custom User Avatar

    Approved.

  • Custom User Avatar

    The error was in the scope.
    I would say that this is strange, because if you run everything single-handedly, then everything goes well.
    I have fixed the error, thanks.

  • Custom User Avatar

    Oh, so it appears "expectation from our test" was correct after all :^)

  • Custom User Avatar

    I totally agree with you. This is where the work is done in an array within an array. I saw a great solution here via replace and regExp

  • Custom User Avatar

    OP: posts unformatted code
    Also OP: " Everything is written very clearly"

    See this paragraph for info how to post your code very clearly.

  • Custom User Avatar

    Ah, okay, I figured out what is going on.

    The expectation is correct. Please, check how the doTest function works, you have its definition on your hands.

    function doTest(input, expected) {
      const actual = "your value"; // toWeirdCase(input);
      const message = `for ${JSON.stringify(input)}\n`;
      assert.strictEqual(actual, expected, message);
    }
    
    it("Sample Tests", function () {
      doTest("input value", "expected value");
    });
    

    Runner result

    So, kata is okay, your code is at fault.

    Hint: There's probably a few reasons folks say not to use global scoped variables in your code. You just managed to hit one of these reasons.

    Hint 2: this

  • Custom User Avatar

    It's impossible to figure out what your code is, use markdown to paste your code

    ```javascript
    like this
    ```    
    
  • Custom User Avatar

    Your function has a bug, it returns wrong results when it's called more than once. Try following test cases:

    doTest("YHhFiUzJ yo", 'YhHfIuZj Yo');
    doTest("YHhFiUzJ yo", 'YhHfIuZj Yo');
    

    Run both tests one after another, and you will the that the first one passes, and the second one fails.

  • Custom User Avatar

    Before clicking that the problem has been solved, you need to check the code. Everything is written very clearly here that the code with the wrong test is expected. P.S for MikChan(expected is an expectation from your test and it is not correct. since the first character must be uppercase)

  • Custom User Avatar

    Are you laughing? My code will return the correct value 'ZtK AuWyK Dy HqV'
    (it also says that he was just expecting the meaning of the first character with a small letter)

  • Custom User Avatar

    Because your code gives a wrong answer. For the input "ZTK AUWyK Dy HqV" it should return "ZtK AuWyK Dy HqV", but returns "zTk AuWyK Dy HqV" (the first letter must be uppercase).

    Not an issue.

  • Custom User Avatar

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