There is an array
ar = [1,4,5,7,3,6,2,0,9,0,10,0,0]
Sort it
ar.sort(function(a,b){ return ab; })
We get 0,0,0,0,1,2,3,4,5,6,7,9,10
Question: how to sort the array so that you can get 1,2,3,4,5,6,7,9,10,0,0,0,0,0
There is an array
ar = [1,4,5,7,3,6,2,0,9,0,10,0,0]
Sort it
ar.sort(function(a,b){ return ab; })
We get 0,0,0,0,1,2,3,4,5,6,7,9,10
Question: how to sort the array so that you can get 1,2,3,4,5,6,7,9,10,0,0,0,0,0
Source: https://ru.stackoverflow.com/questions/265132/
All Articles