more generic sort on each condition js

Solutions on MaxInterview for more generic sort on each condition js by the best coders in the world

showing results for - "more generic sort on each condition js"
Stuart
09 Mar 2016
1array.sort(function(o1,o2){
2  if (sort_o1_before_o2)    return -1;
3  else if(sort_o1_after_o2) return  1;
4  else                      return  0;
5});
6
similar questions
queries leading to this page
more generic sort on each condition js