参考 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.

示例

语法

sort(list, [count])

参数

list

Array to sort

count

number of elements to sort, starting from 0

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

相关参考