Skip to content

Instantly share code, notes, and snippets.

@lauri-kaariainen
Created December 23, 2013 00:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lauri-kaariainen/8089926 to your computer and use it in GitHub Desktop.
Save lauri-kaariainen/8089926 to your computer and use it in GitHub Desktop.
Array with morse-code as keys (in javascript).
var abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var morsecode =[
'.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....',
'..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.',
'--.-', '.-.', '...', '-', '..-', '...-', '.--', '-..-',
'-.--', '--..'
];
var morseArray = new Array();
var length = abc.length;
for(var i = 0;i < length;i++){
morseArray[morsecode[i]] = abc[i];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment