Welcome to the Treehouse Community
Looking to learn something new?
My solution is good?
Here is my solution. Is it good?
/* First Generator */ var ask = prompt("Tell a number please:"); var number = parseInt(ask); var result = Math.floor(Math.random()*number)+1; document.write("The" + " " + "number" + " " + "is" + " " + result + "<br /><br />" ); /* Second Generator */ var num = prompt("Tell a number please:"); var int = parseInt(num); var num2 = prompt("Tell an other number please:"); var int2 = parseInt(num2); var result2 =Math.floor(Math.random() * (int2-int))+int; document.write("The" + " " + "number" + " " + "is" + " " + result2);
Working solutions are always good solutions. Nice job figuring out how to generate a random number from two user inputs!
One thing I noticed that might help to make it easier on you is to modify the document.write lines without concatenating spaces unnecessarily. Spaces can be part of a continuous string.
document.write("The number is " + result + "<br /><br />" );
Thanks for sharing!
thanks for help.