Javascript randomly extracts 10 numbers that are not repeated between 0 and 100, and randomly extracts 0-

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.