Skip to content
#

sort-array

Here are 8 public repositories matching this topic...

Language: All
Filter by language

The sort() method sorts the items of an array. The sort order can be either alphabetic or numeric, and either ascending (up) or descending (down). By default, the sort() method sorts the values as strings in alphabetical and ascending order. This works well for strings ("Apple" comes before "Banana"). However, if numbers are sorted as strings, "25" is bigger than "100", because "2" is bigger than "1". Because of this, the sort() method will produce an incorrect result when sorting numbers.

  • Updated Oct 12, 2020

Improve this page

Add a description, image, and links to the sort-array topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the sort-array topic, visit your repo's landing page and select "manage topics."

Learn more