Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - The javascript question has not been answered for a long time. Handsome boys and girls, please help me!
The javascript question has not been answered for a long time. Handsome boys and girls, please help me!
Math.random() * promote.length

This is to multiply a random decimal number by the length of your declared array and integer it.

For example, in this example, it is almost equal to 0.xxxx times 3, and then it is shaped, and the result is a number between 0 and 2. Finally, use promote[index] to output the direct subscript of this array, thus achieving the effect of randomly generating a defined three-line string.

If you think your answer is good, you can consider giving me a few points. .