Writes each word as it gradually builds up 4 words (using a while loop, and an if statement)-- until all words have been written:
^^ THE 4 WORDS ARE WRITTEN HERE
If the alert wasn't happening between each loop iteration, the 4 words would be written extremely quickly.
So if you want the loop just to create/execute something quickly, take the alerts out.
But if you want the loop to execute more slowly, the easiest solution is to EITHER:
- Keep the alerts
- Use a different method and NOT a loop (it is hard to safely slow loops down - crashes and errors tend to result).
(a good way to get a slower effect could be a JS setTimeout [see the week 11 section of the Resources page] which calls a function that builds something up step by step in a global variable)