Workshop › Wordle-style Word Guess › Step 15 of 26
Enter with five letters typed turns them into a finished guess: { word, marks } goes into the guesses list and
typing starts again from empty.
```js
let guesses // the finished guesses, each { word, marks }
guesses = []
else if (key === 'Enter' && current.length === 5 && guesses.length < TRIES) {
guesses.push({ word: current, marks: score(current, answer) })
current = ''
}
if (key === 'Enter' || key === 'Backspace' || /^[a-z]$/.test(key)) {
```guesses starts as an empty array in reset.else if in type: Enter, five letters, and a try left.push adds { word: current, marks: score(current, answer) } at the end of the list, then current is emptied.let answer, write let guesses ...; in reset, under the answer line, write guesses = [].type, add the Enter else if block at the end.key === 'Enter' || to the if. Press Run.Skills: Keyboard and mouse input, Arrays and objects
← Right letter, wrong place Colour the guesses →