Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Imagine you work at a video streaming service. You want to keep track of where a user was on a video so if they navigate

In the quiz of callback, there was this question as stated,

Q: Imagine you work at a video streaming service. You want to keep track of where a user was on a video so if they navigated away they could come back and resume where they left off. Which function would you use?

but I couldn't understand how can we track when someone navigate away and come back to play video?

2 Answers

Steven Parker
Steven Parker
220,925 Points

You didn't mention which course, or provide a link to the quiz. So I'm not sure if the relates to the answer, but one way to accomplish this would be with the browser's local storage feature.

There's a workshop available here on Using Local Storage with JavaScript.

Steven Parker
Steven Parker
220,925 Points

Prompted by L Haney's recent post, I revisited this old question and found the reference in this quiz.

I think I finally understand the confusion — but the quiz question is only asking which timing function you might use to update a tracking point every second. The local storage would come into play as a way to store the position, and when the user returned to the page to pick up the last saved position for continuing.

So ammarkhan did your original question get answered? You can mark a question solved by choosing a "best answer".
And happy coding!

This is from the "Callback Functions in JavaScript" course.

I was confused by this question too, there's no way to know whether you need to use setInterval or setTimeout, based on the information provided. It's too vague.

Hint: The question does want to be able to track a user's playback at a regular interval, not just once.