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 trialNick Yates
8,621 PointsI can't figure out why my code won't work I even tried debugging in through the console and still nothing.
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 1 " + bottomNumber + " and " + topNumber + ".</p>;
Document.write(message);
2 Answers
Thomas Nilsen
14,957 PointsYou were missing a " in the message variable and document.write is with a small d (not Document.write)
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 1 " + bottomNumber + " and " + topNumber + ".</p>";
document.write(message);
Nick Yates
8,621 PointsI figured it out nevermind! Thanks for the help!
Nick Yates
8,621 PointsNick Yates
8,621 PointsOkay I fixed it but now when I enter the number I get an extra one like this "1 is a number between 1 1 and 3."