Workshop › Typing Rain › Step 13 of 33
After locking on, every letter must be the next one of the target. A wrong letter is ignored. When the whole word is typed, it disappears and the lock is free again.
```js
if (target.text[typed] !== key) return
typed += 1
if (typed === target.text.length) {
words = words.filter((w) => w !== target)
target = null
}
```target.text[typed] is the next letter to type; if the key is different (!==), stop.typed equals the word's length, the word is removed from the list and
target goes back to null.In type, after the if (!target) { ... } block, write the new lines.
Skills: Game states
← Listen to the keyboard Half a word in yellow →