Still waiting for the New York Times to send me a bogus takedown notice
Remove validateinput() and just check if guess is in wordlist
Saksham Mittal 2022-04-05
parent 9379b7d · commit e280212
-rw-r--r--script.js18
1 files changed, 1 insertions, 17 deletions
diff --git a/script.js b/script.js
index 0278159..1a0b2b9 100644
--- a/script.js
+++ b/script.js
@@ -45,28 +45,12 @@ function addGuessDisplay(answer, guess, len, hint) {
}
-function validateInput(str, len) {
-
- let isvalid = true;
-
- for (var i = 0; i < len; i++) {
- let c = str.charAt(i)
- if (c.toUpperCase() == c.toLowerCase()) {
- isvalid = false;
- break;
- }
- }
-
- return isvalid;
-
-}
-
function checkAnswer(event, answer, len, wordlist) {
event.preventDefault();
if (!exit) {
- if (validateInput(input.value, len)) {
+ if (wordlist.includes(input.value)) {
addGuessDisplay(answer, input.value, len, hint);
tries++;
if (input.value == answer) {