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.

Anthony C
4,636 Pointsprompt is not popping up
I am following the code from the video but my prompts are not working. Not sure why.
var correctGuess = false;
var randomNumber = Math.floor(Math.random() * 6) + 1;
var guess = prompt('I am thinking of a number between 1 and 6. What is it?');
if (parseInt(guess) === randomNumber ) {
correctGuess = true;
} else if ( parseInt(guess) < randomNumber ) {
var guessMore = prompt('Try again. The number I am thinking of is more than ' + guess);
if (parseInt(guessMore) === randomNumber) {
correctGuess = true;
}
} else if ( parseInt(guess) > randomNumer ) {
var guessLess = prompt('Try again. The number I am thinking of is less than ' + guess);
if (parseInt(guessLess) === randomNumber) {
correctGuess = true;
}
if ( correctGuess ) {
document.write('<p>You guessed the number!</p>');
} else {
document.write('<p>Sorry. The number was ' + randomNumber + '.</p>');
}
MODERATOR EDIT: Added Markdown
to the code snippet so that it is readable in the community. Please refer to the Markdown Cheatsheet
when posting code snippets for the proper way to do so in the Community Forum.

Anthony C
4,636 PointsThank you for the help!

Valerie Way
8,544 PointsI'm having a similar problem.
var correctGuess = false; var randomNumber = Math.floor(Math.random() * 6 ) + 1; var guess = prompt('I am thinking of a number between 1 and 6. What is it?'); if (parseInt(guess) === randomNumber ) { correctGuess = true; } else if (parseInt(guess) < randomNumber ) { var guessMore = prompt ('Try again. The number I am thinking of is more than ' + guess); if (parseInt(guessMore) === randomNumber { correctGuess=true; } } else if (parseInt(guess) > randomNumber ) { var guessLess = prompt('Try again. The number I am thinking of is less than ' + guess); if (parseInt(guessLess) === randomNumber { correctGuess=true; } if ( correctGuess ) { document.write('<p>You guessed the number!</p>'); } else { document.write('<p>Sorry. The number was ' + randomNumber +'.</p>'); }
Matthew Smith
10,945 PointsMatthew Smith
10,945 PointsYou didn't close your conditional statement on line 11 -- there's a " { " but not a closer "}".
Here's what I did and made it work!