用于对数组进行排序的函数是 compareFunction,该函数是作为参数传递给 sort 函数的。
The function used to sort the array is the compareFunction that was passed into the function when it was called.
比如,compare方法比较两个字符串;sort和asort方法以与相应的php数组函数相同的方式对数组或关联数组进行排序。
For example, the compare method compares two strings; the sort and asort methods sort arrays or associative arrays in a way similar to the corresponding PHP array functions.
应用推荐