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 JavaScript Basics (Retired) Working With Numbers The Random Challenge Solution

What am I missing?

After doing it myself then copying the video then recopying 20 times. I don't know why its not working.

Here is the snapshot https://w.trhou.se/udw6btre9y

2 Answers

The only thing i can see is there are Newlines on your line 6 and 8. I hit backspace on both and everything worked the way it is supposed too. The code should look like this:

var input1 = prompt("Please type a starting number");
var bottomNumber = parseInt(input1);
var input = prompt("Please type a number");
var topNumber = parseInt(input);
var randomNumber = Math.floor(Math.random() * (topNumber - bottomNumber + 1)) + bottomNumber;
var message = "<p>" + randomNumber + " is a number between " + bottomNumber + "and " + topNumber + ".</p>";
document.write(message);

Just make sure your not hitting enter until after you are finished with the line even if it's to the edge.

The error is you need to have the message variable on one line, you can not hit return or break the line:

var message = "<p>" + randomNumber + " is a number between " + bottomNumber + " and " + topNumber + ".</p>";

If you look in the console you will see the error. "Line break". when debugging its always best to check the console for errors.