JavaScript JavaScript Numbers The Math Object Random Number Challenge – Solution

Here's my solution

// Collect input from a user

// Convert the input to a number

// Use Math.random() and the user's number to generate a random number

// Create a message displaying the random number

let inputHigh = parseInt(prompt('Enter a number 1 thru 6.')); let randomNumber = Math.floor( Math.random() * 6) + 1; //Math.random() will generate a random number //ParseInt will convert user input into an integer number //and it will prevent me from creating an extra variable //also I made use of if statements to combine what I already learned with JS.

if(inputHigh === randomNumber) { console.log("you gess correct"); } else { console.log(the correct nnnumber ${randomNumber} || your input ${inputHigh});; }