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! While you're at it, check out some resources Treehouse students have shared here.
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 trialLuke Markham
Front End Web Development Techdegree Graduate 17,289 Pointstimer reset with first "console.log('starting')"
At the start we have "ticking..." logging to the console, then we go on to console log "starting" via the if statement in handleStopwatch.
However, I don't understand how clicking "start" and invoking the handleStopWatch could cause the "ticking..." console.log to restart ?
1 Answer
Tobias Edwards
14,458 PointsThe ticking doesn't restart. In Google Chrome's console, the number next to ticking represents the number of ticking outputs in a row.
Since starting was outputted to the console, the number of consecutive ticking outputs is reset to 0. Also, the console shows the order of outputs, so if we have:
ticking ticking ticking starting ticking ticking
This is the same as:
ticking (3)
starting
ticking (2)
Not to be confused with:
ticking (5)
starting
Because then the order of outputs is lost.
I hope that makes sense.