JavaScriptArray.sortArray methodsSorting
Why JavaScript Array.sort() Gives the Wrong Numeric Order
Learn why JavaScript sort() orders numbers like strings, how to write ascending and descending comparators, and how to avoid mutating arrays.
Practical guides for cleaner URLs, smarter SEO, and a more thoughtful web. Find your next useful idea.
Explore the journal
1 article
Learn why JavaScript sort() orders numbers like strings, how to write ascending and descending comparators, and how to avoid mutating arrays.