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 trialDalibor Nikolic
5,283 PointsSo im on the challenge and i was wondering if i was on the right track for this challenge
This is my code that i got, not really sure if i totally understood the challenge so i tried to solve it from what I've learned so far.
var rng = Math.random();
var user1 = prompt('Pick a number ');
var userNum = parseInt(user1);
var print = alert(rng + userNum);
2 Answers
Thomas Beaudry
29,084 PointsHere Is what he is looking for, Good luck with the track, Full stack Javascript is my favorite! var input = prompt('Please type 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);
Thomas Beaudry
29,084 Pointsvar input = prompt('Please type 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);
Gena Israel
2,047 Pointswhat is the "<p>" for?