Instantly share code, notes, and snippets.

Embed
What would you like to do?
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