generate random number nodejs

const randomNumber = Math.floor(Math.random() * 100);
console.log(randomNumber);
  1. The Math.random() function generates a random floating-point number between 0 (inclusive) and 1 (exclusive).
  2. We multiply the result of Math.random() by 100 to expand the range of the random number.
  3. The Math.floor() function is used to round down the resulting number to the nearest integer.
  4. Finally, we log the random number to the console using console.log().