Ad
  • Default User Avatar

    how to use morse code dictionary provided by author in JavaScript?

  • Custom User Avatar

    You should use the Morse code they gave you:

    The Morse code table is preloaded for you as a dictionary, feel free to use it:

    Coffeescript/C++/Go/JavaScript/Julia/PHP/Python/Ruby/TypeScript: MORSE_CODE['.--']
    C#: MorseCode.Get(".--") (returns string)
    F#: MorseCode.get ".--" (returns string)
    Elixir: @morse_codes variable (from use MorseCode.Constants). Ignore the unused variable warning for morse_codes because it's no longer used and kept only for old solutions.
    Elm: MorseCodes.get : Dict String String
    Haskell: morseCodes ! ".--" (Codes are in a Map String String)
    Java: MorseCode.get(".--")
    Kotlin: MorseCode[".--"] ?: "" or MorseCode.getOrDefault(".--", "")
    Racket: morse-code (a hash table)
    Rust: MORSE_CODE
    Scala: morseCodes(".--")
    Swift: MorseCode[".--"] ?? "" or MorseCode[".--", default: ""]
    C: provides parallel arrays, i.e. morse[2] == "-.-" for ascii[2] == "C"
    NASM: a table of pointers to the morsecodes, and a corresponding list of ascii symbols
    All the test strings would contain valid Morse code, so you may skip checking for errors and exceptions. In C#, tests will fail if the solution code throws an exception, please keep that in mind. This is mostly because otherwise the engine would simply ignore the tests, resulting in a "valid" solution.

  • Default User Avatar

    That is so stupid x)

  • Default User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    In addition to letters, digits and some punctuation, there are some special service codes, the most notorious of those is the international distress signal SOS (that was first issued by Titanic), that is coded as ···−−−···. These special codes are treated as single special characters, and usually are transmitted as separate words.

    Probably related to that?

  • Default User Avatar

    Same for this 'SOS! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.' sentence in morse
    When i write it in morse in my IDLE it work and during the test it show only ' ! THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.'

  • Default User Avatar

    I dont know why i get the following error:
    Got '', expected 'SOS'

    Bcs when i write in my code(IDLE) SOS in morse it works and when im testing on the site it dont.
    (...---... --> SOS)