Ad
  • Custom User Avatar

    Ya it's built into the codewars enviornment only so you may not be able to access it through the use of your own editor (VSC/Atom/etc.)

    Using codewars for the different languages you can access the library using the note left by the creator. Since I primarily use JS all I did was console.log(MORSE_CODE) to view the entire object to see what was what.

    I hope this helps. Here's the note the creator left for all of the different languages.

    NOTE: For coding purposes you have to use ASCII characters . and -, not Unicode characters.

    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)
    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(".--", "")
    Rust: self.morse_code
    Scala: morseCodes(".--")
    Swift: MorseCode[".--"] ?? "" or MorseCode[".--", default: ""]
    C: provides parallel arrays, i.e. morse[2] == "-.-" for ascii[2] == "C"

  • Custom User Avatar

    Hey,
    can you explain in little more details please ? I have a valid solution that works in my editor, with my own object, copied from web with Morse Code key: value pairs. But my solutions fails on the very first line of code test, I'm pretty sure that is because I have unicode key values instead ascii. Please help with this preloaded morse code object, how to acces it ?

  • Custom User Avatar

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