Summary
Guesses that are not real words (e.g. ZZZZZ) are accepted by the game as valid guesses, even though they should be rejected.
Root cause
In src/components/GuessForm/GuessForm.js, guess validation only checks that the input is 5 characters A-Z:
const validateLength = /([A-Z]){5}/g
if (!guess.match(validateLength)) {
return window.alert("Guess must have exactly 5 A-Z characters")
}
There is no check anywhere in the codebase that the guess is an actual valid word. The WORDS list in src/data.js is only used to pick the secret answer (sample(WORDS) in Game.js) - it is never used to validate a submitted guess.
Reproduction
const validateLength = /([A-Z]){5}/g;
"ZZZZZ".match(validateLength); // truthy -> guess is accepted
Typing ZZZZZ (or any other 5 letter A-Z string) into the guess input and submitting it is accepted as a normal guess, consuming one of the player's attempts, even though ZZZZZ is not in the word list and isn't a real word.
Suggested fix
Validate the submitted guess against a word list (either reuse WORDS from src/data.js, or add a separate, larger dictionary of acceptable guesses) before accepting it, and show an alert like "Not in word list" if it doesn't match, similar to the real Wordle.
Summary
Guesses that are not real words (e.g.
ZZZZZ) are accepted by the game as valid guesses, even though they should be rejected.Root cause
In
src/components/GuessForm/GuessForm.js, guess validation only checks that the input is 5 characters A-Z:There is no check anywhere in the codebase that the guess is an actual valid word. The
WORDSlist insrc/data.jsis only used to pick the secret answer (sample(WORDS)inGame.js) - it is never used to validate a submitted guess.Reproduction
Typing
ZZZZZ(or any other 5 letter A-Z string) into the guess input and submitting it is accepted as a normal guess, consuming one of the player's attempts, even thoughZZZZZis not in the word list and isn't a real word.Suggested fix
Validate the submitted guess against a word list (either reuse
WORDSfromsrc/data.js, or add a separate, larger dictionary of acceptable guesses) before accepting it, and show an alert like "Not in word list" if it doesn't match, similar to the real Wordle.