MCPcopy Index your code
hub / github.com/WebDevSimplified/wordle-clone / submitGuess

Function submitGuess

script.js:15367–15387  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15365}
15366
15367function submitGuess() {
15368 const activeTiles = [...getActiveTiles()]
15369 if (activeTiles.length !== WORD_LENGTH) {
15370 showAlert("Not enough letters")
15371 shakeTiles(activeTiles)
15372 return
15373 }
15374
15375 const guess = activeTiles.reduce((word, tile) => {
15376 return word + tile.dataset.letter
15377 }, "")
15378
15379 if (!dictionary.includes(guess)) {
15380 showAlert("Not in word list")
15381 shakeTiles(activeTiles)
15382 return
15383 }
15384
15385 stopInteraction()
15386 activeTiles.forEach((...params) => flipTile(...params, guess))
15387}
15388
15389function flipTile(tile, index, array, guess) {
15390 const letter = tile.dataset.letter

Callers 2

handleMouseClickFunction · 0.85
handleKeyPressFunction · 0.85

Calls 5

getActiveTilesFunction · 0.85
showAlertFunction · 0.85
shakeTilesFunction · 0.85
stopInteractionFunction · 0.85
flipTileFunction · 0.85

Tested by

no test coverage detected