Reference sort()

sort()

Sorts an array of numbers from smallest to largest, or puts an array of words in alphabetical order. The original array is not modified; a re-ordered array is returned. The count parameter states the number of elements to sort. For example, if there are 12 elements in an array and count is set to 5, only the first 5 elements in the array will be sorted.

Examples

Syntax

sort(list, [count])

Parameters

list
Array:

Array to sort

count
Integer:

number of elements to sort, starting from 0

Returns

Array: the sorted list
Notice any errors or typos? Please let us know. Please feel free to edit src/utilities/array_functions.js and open a pull request!

Related References