sort array with integer strings type in jQuery

后端 未结 5 1356
后悔当初
后悔当初 2020-12-10 19:25

I have a array of integers of type string.

var a = [\'200\',\'1\',\'40\',\'0\',\'3\'];

output

>>> var a = [\'2         


        
5条回答
  •  青春惊慌失措
    2020-12-10 19:56

    Most javascript implementations, as far as I know, provide a function you can pass in to provide your own custom sorting.

    Mozilla sort Method

提交回复
热议问题