JavaScript JavaScript Numbers The Math Object Random Number Challenge – Solution

Random 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.');

OOPS! I know I spelled below incorrectly.

Nice. This helps!

T. Gontarek I tested your solution and if you do low number 2 and high number 4 you can get a 1 as a result.