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 trialB G
1,866 PointsNot counting down after the first prompt
It will not count down after the first prompt
var questions = 3;
var questionsLeft = ' [' + questions + ' questions left]';
var adjective = prompt('Please type an adjective' + questionsLeft);
questions -= 1;
questionsLeft = ' [' + questions + ' questions left]';
var verb = prompt('Please type a verb' + questonsLeft );
questions -= 1;
questionsLeft = ' [' + questions + ' questions left]';
var noun = prompt('Please type a noun' + questionsleft);
alert('All done. Ready for the message?');
var sentence = "<h2>There once was a " + adjective;
sentence += ' programmer who wanted to use JavaScript to ' + verb;
sentence += ' the ' + noun + '.</h2>';
document.write(sentence);
Moderator edited: Markdown added so that code renders properly in the forums.
4 Answers
Jennifer Nordell
Treehouse TeacherHi there! You have two small typos which are causing syntax errors and causing your program to stop running.
In two separate cases you have misspelled the variable name questionsLeft
.
// your code
var verb = prompt('Please type a verb' + questonsLeft );
//corrected code
var verb = prompt('Please type a verb' + questionsLeft ); // note the "i" in questionsLeft
And here is a capitalization error:
// your code
var noun = prompt('Please type a noun' + questionsleft);
// corrected code
var noun = prompt('Please type a noun' + questionsLeft); // note the L
Always check your console for errors if something strange is happening. It's the best starting point to figure out what's wrong. Hope this helps!
B G
1,866 PointsThank you. I guess my eyes are getting tired.
Marvin Gerodias
2,177 PointsJong Kim, your prompts are referencing to 'questionsLeft' but your objects in line 6 and 11 prior to the prompts says 'questionLeft' >>> notice the typo.
Jong Kim
6,145 PointsThank you Marvin!
Frank Formica
3,595 Pointshttps://teamtreehouse.com/workspaces/39014582#
mine is not counting down either
Jennifer Nordell
Treehouse TeacherFrank Formica I would love to help but first, this should probably be posted as a separate question. Secondly, the link you have provided is private to you. If anyone else tries to view it we get a 404 with a Bummer! message. However, if you click the camera looking icon on the upper right side of your workspace, this will create a "snapshot" of your workspace which you then can link. We can use that link to fork your workspace and have a look around.
Hope this helps!
Jong Kim
6,145 PointsJong Kim
6,145 Pointshttps://w.trhou.se/s2ed4kqklj
Could you please check mine too???
I have also counting problem. Everything goes well except for not counting down.