Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
karan BadhwarWeb Development Techdegree Graduate 18,135 Points
What is the
console.log(timeoutId); , it always prints 1 and how that helps us to cancel the setTimeout function?
Steven Parker228,026 Points
You can have more than one timeout active at the same time. If you do, each one will have a different TimeoutID.
The TimeoutID must be passed as an argument when you call clearTimeout to cancel the timer before the time elapses.. But if your program doesn't ever cancel a timer, is isn't needed.