Ad
  • Default User Avatar

    Look at the line of code where you get an error and try to debug.

  • Custom User Avatar

    No. All works and worked fine. But random tests sent an array first to your kata and then to my solution. So when you broke data in the array in your solution, then that broken one was sent to my solution. And the result was random.

  • Custom User Avatar

    OK. I modified kata and it creates a copy of array before it's sent to the solution. I hope it solved your issue ;)

  • Custom User Avatar

    Nope. It works fine. It doesn't leak. I have just checked it. It's a javascript. Maybe you are modifing input data and your code breaks kata itself. Don't modify input.

  • Custom User Avatar

    It looks like it leaks for me. it leaks in 2 places even. You were lucky that your solution passed random tests.

  • Default User Avatar

    You need to do a deeper analysis of the group, it is not enough to take the most popular letter of the group and assume that it was encoded with the letter "E" (this does not always work). Look at it this way - each group is encrypted with the Caesar cipher and for that group you need to understand what shift was used in its encryption. By analyzing the shift - you can find the correct letter.

  • Custom User Avatar

    As akar-0 points out it is a valid JavaScript variable name (in fact there's a couple popular libaries built around it), but the convention originated in some other language (or perhaps even a linter?) to use _ as a shorthand for "this argument isn't used".

  • Custom User Avatar

    Yes. Its value is not actually used so there's no need to declare it with a handy name (though we could use _ as a variable name in JS).

  • Custom User Avatar

    I dont get the rules then lol. If you go NORTH, WEST, SOUTH AND EAST , I end up in the same point I started. Are the directions in a global coordinate or they are relative to the guy walking?

  • Default User Avatar

    MORSE_CODE is the dictionary name, you don't need to import it.

    function decodeMorse(morse_code){
      let morse_W = '.--';
      let letter_W = MORSE_CODE[morse_W];
        console.log(`morse_W  = "${morse_W}"`);
        console.log(`letter_W = '${letter_W}'`);
    }
    
  • Custom User Avatar

    Coffeescript/C++/Go/JavaScript/Julia/PHP/Python/Ruby/TypeScript: MORSE_CODE['.--']

    It's the first one in the description's note.

  • Custom User Avatar

    Correct, but this kata works with different rules. See description for this exact case and clarification.