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 trialAndrew Chung
5,203 PointsPrompt not appearing
From what I can tell my code is identical to the code shown in the video, however I can't get the first step to show up. When I load the page the prompt doesn't appear.
var input = prompt("Pick a number"); var topNumber = parseInt(input); var randomNumber = Math.floor(Math.random() * topNumber) + 1; var message = "<p>" randomNumber + " is a number between 1 and " + topNumber + ".</p>"; document.write(message);
2 Answers
Bart Bruneel
27,212 PointsHello Andrew,
there seems to be a + sign missing before randomNumber, like this:
var message = " " + randomNumber + " is a number between 1 and " + topNumber + ".";
That will do the trick.
Happy coding!
Tom Sager
18,987 PointsThis portion of your code is not well formed:
message = "" randomNumber
Try looking at the page in the debugger. In most browsers you can right-click on the page and select "Inspect Element". Then look for the console window, and check any error messages there.
Andrew Chung
5,203 PointsI didn't even see that. These syntax errors get me so often. Thanks for pointing it out.
Andrew Chung
5,203 PointsAndrew Chung
5,203 PointsThanks, I really need to watch for these syntax errors.