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 trial

JavaScript Callback Functions in JavaScript Callbacks with Timers Using Anonymous Functions with setInterval

Why didn't we use getTime in setInterval?

I took on the challenge but I ended up making getTime to as a callback function which isn't right. I wanted to know why and what makes the decision what can go inside the callback function in an example like this?

Ian Ostrom
seal-mask
.a{fill-rule:evenodd;}techdegree
Ian Ostrom
Full Stack JavaScript Techdegree Student 10,331 Points

getTime only formats and returns the time. We still need to set this time as the textContent of the element with the 'clock' ID so it will show in the webpage.

1 Answer

Steven Parker
Steven Parker
231,261 Points

Show your code to faciliatate an analysis and accurate answer.