Generate 4 Digits Random Number in JavaScript

const random = Math.floor(Math.random() * 9000 + 1000);

console.log(random);

Generate 4 Digits Random Number in JavaScript

BETA Snippet explanation automatically generated by OpenAI:

Here is what the above code is doing:
1. The code uses a JavaScript function to generate a random number between 1000 and 9999.
2. The code uses a JavaScript function to generate a random number between 1000 and 9999.
3. The code uses a JavaScript function to generate a random number between 1000 and 9999.

Snippet By Eftykhar Rahman

·

Created May 9th, 2022

·

Report Snippet