Workshop › Typing Rain › Step 5 of 33
Many words will fall at once. Each word is an object { text, x, y }, and all of them live in an array words.
draw writes every word where it is.
```js
let words // { text, x, y }
function reset() {
words = [
{ text: 'rocket', x: 40, y: 120 },
{ text: 'cat', x: 300, y: 60 },
]
}
for (const w of words) ctx.fillText(w.text, w.x, w.y)
reset()
draw()
```let words makes a variable whose value can change later; reset fills it.[ ... ] is an array; each { text, x, y } inside is an object, three named values in one package.for (const w of words) runs the line once for each word, calling it w; w.text reads the text inside it.reset() sets up the words once, before the first draw().FONT, after an empty line, write let words and reset.draw, replace the fillText('rocket', ...) line with the for line.reset() above draw().Skills: Arrays and objects
← A function that draws Make them fall →