How Can I Generate 4 Digits Random Numbers Using JavaScript?

Hello guys today i will tell you through experts tool that How you can generate a random number of 4 digits by javascript. so let’s go

Friends, I will try to explain you through javascript code. The code to generate a random number is given below, I am going to tell you how to use it.

<p id="fourdigitnumber"></p><script>var fourdigitnumber= Math.floor(1000 + Math.random() * 9000);
document.getElementById("fourdigitnumber").innerHTML=fourdigitnumber;
// alert(fourdigitnumber);
</script>