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

In coding the countdown, why do we keep redefining questionsLeft? Why doesn't it stay defined?

I tried the program without repeating var questionsLeft = "[" + questions + " questions left]";

and it returned NaN.

Thanks!

2 Answers

Heny, hi. I believe it's because you haven't reach the point YET of using functions to keep from repeating code. As far as WHY it has to keep being redefined, might be better answered if you post the code. Maybe the way it's presented and also the way you tried it that didn't work. Also, it can be a good idea (although not necessary) to post the code by clicking the "get help" box under the video.

  • 1: so that if someone were inclined, they could watch the video associated with the question
  • 2: If someone has asked a similar question, it may show that and you might find the answer you are looking for.

Thanks for taking the time to reply John. Your tip about posting the code under "get help" is useful as well- I didn't realize this was not grouped with the video in question.