FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 67   



Following program shows you how to take a max limit from user and generate a random number till that number.
In this program we get max limit number from user and generate a random number using Math.random()

var maxLimit = prompt("Enter maxlimit to generate a random number:")
var result = Math.floor((Math.random() * maxLimit) + 1);
console.log("Random number is: " + result);

Output:

Enter maxlimit to generate a random number:
100
Random number is: 65



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News