function compareProperty(propName) {
  return function(a, b) {
    if (a[propName] < b[propName])
      return -1;
    if (a[propName] > b[propName])
      return 1;
    return 0;
  };
}
// Returns a comparer function suitable for Array.sort().
Returns a comparer function suitable for Array.sort().
Returns a comparer function suitable for Array . sort () .
function compareProperty(propName) {
  return function(a, b) {
    if (a[propName] < b[propName])
      return -1;
    if (a[propName] > b[propName])
      return 1;
    return 0;
  };
}
function compareProperty ( propName ) { return function ( a , b ) { if ( a [ propName ] < b [ propName ] ) return - 1 ; if ( a [ propName ] > b [ propName ] ) return 1 ; return 0 ; } ; }
Returns a comparer function suitable for Array.sort().
Returns a comparer function suitable for Array . sort () .