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 trialJonathan Perez
1,896 PointsWhy is setInterval called repeatedly?
At the end of the video, the browser shows new dates repeatedly being written to the screen. Why is setInterval(fcn, 1000) being called over and over again? Wouldn't it only be called once, writing a single date to the screen? The response Stream is still open, but why does that cause setInterval to be called more than once?
1 Answer
Milo Winningham
Web Development Techdegree Student 3,317 PointsThe setInterval
function itself is only being called once, but it makes the given function fcn
run at the given interval of 1000 milliseconds.
Faisal Julaidan
13,944 PointsFaisal Julaidan
13,944 Pointsaha! but, how can I stop this function from being called repeatedly?