Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
How to remove duplicate number in array jquery?

I want to create random number generator. I have a quantity array. So I push when I create a random number. quantityArray.push([Math.floor(Math.random() * (endRange - startRange + 1)) + startRange]);

It's work but this array elements are must be unique. So I write check method like this:

let uniqueSites = quantityArray.sort();
                    let temp = uniqueSites[0];

                    for(let z =1; z<=uniqueSites.length; z++)
                    {
                        if(temp == uniqueSites[z])
                        {
                          uniqueSites.pop(uniqueSites[z]);
                        }
                    } 
    ```

But doesn't work. In my opinion, I removed element and I check length after if length same array is unique else create a random number and push array.
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!