Javascript randomly extracts 10 numbers that are not repeated between 0 and 100, and randomly extracts 0-
Currently, only two simple methods are available to help you randomly extract 10 numbers that are not repeated between 0 and. The specific content is as follows:
FirstRewritable array Length
Idea: You can use the for loop from 0 to 100 to put it in an array, and then randomly disrupt the 100 numbers using sort, then, the length of the array is rewritten to 10, and 10 different numbers are obtained.
<! DOCTYPE html>
SecondThe unique key value of a json object is used.
Ideas:Define an empty array and an empty json object respectively to save the array,
<! DOCTYPE html>
I hope this article will help you learn about javascript programming.
Articles you may be interested in:
- Random Number generated by js: random example of the random function
- Multiple methods for generating random strings in JS
- Use the js Math. random () function to generate random numbers between n and m.
- How to Implement Random Switching of background images on webpages using js
- Javascript to obtain random numbers of four digits or letters
- Js achieves random acquisition of elements from Arrays
- Method for Calculating random numbers between any values in js
- JavaScript to implement a simple random lottery
- JS method for achieving random round ball Effects
- Js implementation click the button to set random background color for the Div Layer