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

129
Views
JS sort method clones the strings in the array but the array length is the same

fiddle

fiddle has more items so it is with the issue. please check it

I tried using a smaller sized array and it works until some number of elements but after some point, it duplicates strings though sorting works. Probably overwrites one string on another. Thanks very much

let uninames = `adnan menderes university
  ahi evran university
  akdeniz university
  afyon kocatepe university
  anadolu university
  ankara university
  istanbul arel university
  atatürk university
  atilim university
  bahcesehir university
  balikesir university
  baskent university
  celal bayar university
  beykent university
  bilecik university
  istanbul bilgi university
  bilkent university
  boğaziçi university
  cag university
  cankaya university
  canakkale (18th march) university
  cukurova university
  cumhuriyet (republik) university
  dokuz eylül university
  batman university
  bayburt university`;

let unarr = uninames.split("\n");

unarr.sort((a, b) => a > b);
for (let i = 0; i < unarr.length; i++)
  document.write(i + ") " + unarr[i] + "<br>");

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!