Summary
If you have mastered this chapter, you now know the following:
How
setTimeout()
causes a JavaScript statement to execute in the futureHow to use
clearTimeout()
to cancel a time-outHow to create a timed loop by writing a function that sets a time-out that calls the same function
How to use
parseInt()
to convert a string to a number, and why you might have to do this
If you read the part about coding timing loops the safe way in "A Safer Version of rotateImage()" on page 162, you also know how to write a timing loop that calls a function taking parameters.
To make sure you understand timing loops and how to cancel them, try the following assignment.
Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.