• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Core Syntax > Array.sort()

Array.sort()

JavaScript 1.1+, ECMAScript 1.0+, JScript 3.0+ Nav3+, NES3+, IE 4+ Syntax

							array.sort()
array.sort(function)

Description

The sort() method rearranges the elements of the array based on a sorting order. Table 6.15 lists the argument associated with this method. If the method has no parameters, JavaScript attempts to convert all the elements of the array to strings and then sort them alphabetically. If the array should be sorted some other way, a function must be provided to handle the new sorting algorithm.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint