Skip to content

Instantly share code, notes, and snippets.

@railsstudent
Created December 25, 2016 16:27
Show Gist options
  • Save railsstudent/e3edc7dbc4747b63a249671bd2566fca to your computer and use it in GitHub Desktop.
Save railsstudent/e3edc7dbc4747b63a249671bd2566fca to your computer and use it in GitHub Desktop.
decodeMorse = function(morseCode){
var decodeString = '';
var morseCodeWords = morseCode.split(' ');
for (var i in morseCodeWords) {
var morseCodeArray = morseCodeWords[i].split(' ');
for (var j in morseCodeArray) {
if (MORSE_CODE[morseCodeArray[j]] !== undefined) {
decodeString += MORSE_CODE[morseCodeArray[j]];
}
}
decodeString += ' ';
}
decodeString = decodeString.trim();
return decodeString;
}
@Goldac77
Copy link

thanks, this was helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment