Sorting array using Javascript function - Understanding

后端 未结 2 766
情深已故
情深已故 2021-01-24 06:07

I decided to get shuffled values from array. for that i used this function, i got it from net, it works fine. But i don\'t know, how it\'s works...

any one can help me t

2条回答
  •  隐瞒了意图╮
    2021-01-24 06:37

    array.sort() has an optional parameter that is a sorting function, you can pass a function reference to change the order of the array.

    Maybe this page can be helpful http://www.javascriptkit.com/javatutors/arraysort.shtml

提交回复
热议问题