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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![T. Gontarek](https://secure.gravatar.com/avatar/88e8f3867d6361b1a818c835e7b5a764?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
T. Gontarek
7,030 PointsRandom Number Challenge Part II- My Solution
// Collect input from a user
let userLow = prompt("Enter a low number into the text box bellow.");
let userHigh = prompt("Enter a high number into the text box bellow.");
// Convert the input (as a string) to a number
userLow = parseInt(userLow);
userHigh = parseInt(userHigh);
//conditional if user enters both required numbers
if (userHigh && userLow){
const randomNumber = Math.floor(Math.random(userLow)* userHigh)+1;
console.log(`The random number generated from ${userLow} to ${userHigh} is ${randomNumber}.`)
//if user does not enter required numbers
} else {
console.log('Number is needed to calculate. Reload page and try again.');
}
![kevin hudson](https://secure.gravatar.com/avatar/6975cf164055f5144f9be37b16b8e6dd?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
kevin hudson
Courses Plus Student 11,987 PointsT. Gontarek I tested your solution and if you do low number 2 and high number 4 you can get a 1 as a result.
![boi](https://uploads.teamtreehouse.com/production/profile-photos/10720541/micro_Kratos.jpg)
boi
14,242 PointsThis solution needs a solution.
1 Answer
![T. Gontarek](https://secure.gravatar.com/avatar/88e8f3867d6361b1a818c835e7b5a764?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
T. Gontarek
7,030 PointsOOPS! I know I spelled below incorrectly.
Michael Carreon
6,208 PointsMichael Carreon
6,208 PointsNice. This helps!