Current location - Recipe Complete Network - Complete cookbook - How to write the code of random dish selection with notepad
How to write the code of random dish selection with notepad
The method is as follows:

1. First, define a menu array, and the Math.random () function returns a floating-point number. The range of pseudo-random numbers is from 0 to less than 1, that is, from 0 (including 0) or more, but excluding 1 (excluding 1).

2. use innerHTML to output the results to the page, and use setInterval loop and clearInterval to clear the timer.