Trim answers to avoid false negatives

This commit is contained in:
Nathan McRae 2024-09-02 18:33:30 -07:00
parent 7214994e33
commit 3913dfa1fa

View File

@ -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;