diff --git a/morse-code_files/constants.js b/morse-code_files/constants.js index 6efd9a7..71675e2 100644 --- a/morse-code_files/constants.js +++ b/morse-code_files/constants.js @@ -40,7 +40,8 @@ const MORSE_MAP = { '!': '-.-.--', '=': '-...-', '+': '.-.-.', - '-': '-....-' + '-': '-....-', + 'clear': '........' }; const REVERSE_MORSE_MAP = function() { diff --git a/morse-code_files/morse-code.js b/morse-code_files/morse-code.js index 23778fb..63acc37 100644 --- a/morse-code_files/morse-code.js +++ b/morse-code_files/morse-code.js @@ -540,7 +540,11 @@ class InputGame { // TODO: handle letter being done. const currentLetterCombo = this.dotAndDashStack.join(''); if (currentLetterCombo in REVERSE_MORSE_MAP) { - this.letterStack.push(REVERSE_MORSE_MAP[currentLetterCombo]); + if (REVERSE_MORSE_MAP[currentLetterCombo] == "clear") { + this.letterStack = []; + } else { + this.letterStack.push(REVERSE_MORSE_MAP[currentLetterCombo]); + } } else { // Push a question mark this.letterStack.push('?');