I have a list of objects where I want to sort the objects based on a field I know I can use sort methods. When the comparing field have null values, sorting is not happening
you can deal with the null values inside the comp func:
arrToSort.sort(function (a, b) { if (a[strObjParamToSortBy]==null) return 1 if (b[strObjParamToSortBy]==null) return 0 return a[strObjParamToSortBy] > b[strObjParamToSortBy]; });