From 3913dfa1fa769f653bdab84def8f18b25591af60 Mon Sep 17 00:00:00 2001 From: Nathan McRae Date: Mon, 2 Sep 2024 18:33:30 -0700 Subject: [PATCH] Trim answers to avoid false negatives --- morse-code_files/morse-code.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morse-code_files/morse-code.js b/morse-code_files/morse-code.js index 32a946d..bf2fad7 100644 --- a/morse-code_files/morse-code.js +++ b/morse-code_files/morse-code.js @@ -294,7 +294,7 @@ class ListeningGame { } else { const enteredWord = this.wordInput.value; // console.log('enteredWord: ', enteredWord, 'target: ', this.target); - if (enteredWord.toUpperCase() == this.target.toUpperCase()) { + if (enteredWord.trim().toUpperCase() == this.target.trim().toUpperCase()) { // If they got the word, show message and switch event listener. this.statusElement.textContent = 'Correct! Press enter to play a new round.'; this.messageFound = true;