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

I Want to check if my solution is correct ?

var no1 =prompt("what's ur lucky no# ?");

var firstno = parseInt(no1);

var no2 = prompt("what's ur second luckiest no# ?");

var secondno = parseInt(no2);

var randomiz = Math.floor(Math.random() * (secondno - firstno + 1 )) + firstno;

document.write("<h1> That's you lucky number </h1>" + randomiz);

2 Answers

John Moya
John Moya
17,963 Points

Just a Tip don't use document.write use document.getElementById('id'); and user the innerHTML

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

From what I can tell, your code does work. If you want to check it yourself, you can always open the "console" in your browser, paste in the code and hit enter. I use Chrome on a Mac and just hit option/command/j

Good Job and Keep Coding! :)