# How To Generate Random Number In JavaScript?

Hello Friends, Now let's see example of how to use javascript generate random number example. We will use how to use if generate random number in javascript. Here you will learn how to use javascript generate random number. This is a short guide on generate random number. Let's get started with how to generate random number in javascript. Here i will give you many example how you can check javascript generate random number. Example: 1
```<!DOCTYPE HTML>
<html>
<title>JavaScript Generate Random Number</title>
<body class="bg-dark">
<div class="container mt-5">
<div class="row">
<div class="col-md-6 offset-md-3">
<div class="card">
<h4>JavaScript Generate Random Number</h4>
</div>
<div class="card-body">
<p>Click on the button to generate random 10 digit number</p>
<p id="test"></p>
</div>
</div>
</div>
</div>
</div>
<script>
var tst = document.getElementById('test');
function product() {
var minm = 1000000000;
var maxm = 9999999999;
tst.innerHTML = Math.floor(Math .random() * (maxm - minm + 1)) + minm;
}
</script>
</body>
</html>
```
Output:
```Product Name:
7968125894 (Random Number)
```
Example: 2
```<!DOCTYPE HTML>
<html>
<title>Generate a n-digit number using JavaScript</title>
<body class="bg-dark">
<div class="container mt-5">
<div class="row">
<div class="col-md-6 offset-md-3">
<div class="card">
<h4>JavaScript Generate Random Number</h4>
</div>
<div class="card-body">
<p>Click on the button to generate random 6 digit number</p>
<p id="tst"></p>
</div>
</div>
</div>
</div>
</div>
<script>
var down = document.getElementById('tst');
function emp() {
down.innerHTML = ("" + Math.random()).substring(2, 8);
}
</script>
</body>
</html>
```
Output:
```Company Name :
706174 (Random Number)
```