How to generate Random Number & Text in JavaScript

In this article, you’re going to learn how to learn to generate random number and text

Math.random() generates random number between 0 and 1

Finally the result will be as follow:

If you want to get a whole number or greater than 1 we multiply random numbers by our custom number. In this, I multiplied the random numbers by 10 that I get random number between 0 and 10.

Math.ceill() returns whole number

I think you know it but how to generate random text via Math.random(). Think deeply a minute, give it a try if you solved it you’re a creative programmer else no problem I’ll elucidate it for you.

Generating random text

I f you know string’s method you maybe suss it out if don’t then go back learn string’s methods return here to understand this trick.