Workshop › Typing Rain › Step 31 of 33
The keyboard also teaches: the key for the next letter of the target lights up yellow. Beginners can follow the light while their fingers learn where the letters are.
```js
const next = target && target.text[typed] === keys[i]
ctx.fillStyle = next ? '#facc15' : '#1e293b'
ctx.fillRect(k.x, k.y, KEY_W, KEY_H)
ctx.fillStyle = next ? '#020617' : '#e2e8f0'
```next is true when there is a target and this key is its next letter. With no target, target && ... stops at
null, which counts as false.In the keyboard loop, under const k = ..., write const next, and change the two colors as shown.
Skills: Game states
← Draw the keyboard Tap the keys →