Math.floor(Math.random() * array.length)

mark js returns the index within the length range: Math.floor(Math.random() * array.length)

Guess you like

Origin blog.csdn.net/hety119/article/details/90447770