Ad
  • Custom User Avatar

    SOLVED: Don't modify the 'functions' array. If you pop, push, shift or unshift, it won't work because the tester function also calls the same functions from the same array. The same thing doesn't happen with the first four sample tests because the expected outcomes are hardcoded instead of being evaluated at runtime.

    What he said. Random tests appear to expect the input. I can simply return the input value unchanged and all the random tests are passed but then the first four sample tests are incorrect.

    A couple of examples:

    Log
    function (s){return s.toUpperCase()}
    function (s){return s[0].toUpperCase() + s.substring(1).toLowerCase()}
    function (s){return s.split("")}
    function (l){return l.join("-")}
    function (s){return s[0].toUpperCase() + s.substring(1).toLowerCase()}
    Random test 11 - Expected: '"lmxx9k"', instead got: '"L-m-x-x-9-k"'
    Log
    function (s){return s.toLowerCase()}
    function (s){return s[0].toUpperCase() + s.substring(1).toLowerCase()}
    function (s){return s.toUpperCase()}
    function (s){return s.toUpperCase()}
    function (s){return s[0].toUpperCase() + s.substring(1).toLowerCase()}
    Random test 12 - Expected: '"wxb3wf"', instead got: '"Wxb3wf"'

  • Custom User Avatar

    You may try posting your code in a comment with a spoiler tag, so somebody may look at it. Before closing the issue I've completed the JS version, and verified that I'm applying all the functions correctly, and the intermediate values are changing, resulting in a value (possibly) different from the input.

  • Custom User Avatar

    But the question is: are you modifying the input or not?

  • Custom User Avatar

    JS tests are working perfectly fine. Make sure you're not modifying the input.