sort json array

علی ذوالفقار
1400/12/21 09:12:21 (176)
function sortByProperty(prop){  
   return function(a,b){  
      if(a[prop] > b[prop])  
         return 1;  
      else if(a[prop] < b[prop])  
         return -1;  
      return 0;  
   }  
}

items.sort(sortByProperty(“id”)); //sort according to id
Back