SOURCE

function createComparisonFunction(propertyName){
  return function(obj1,obj2){
    var value1 = obj1[propertyName];
    var value2 = obj2[propertyName];
    
    if(value1<value2){
      return -1
    }else if(value1>value2){
      return 1;
    }else{
      return 0;
    }
  }
}
console 命令行工具 X clear

                    
>
console