Recent

Custom Controls Using Angular Material

Git Repo:  https://github.com/yawahang/ohcontrols Features DatePicker (Date Picker, Time Picker, Date Time Picker, and many more) RatingPicker (Vertical, Horizontal, Custom Icons) Select (Single Select, MultiSelect, Single Column, MultiColumn) Recursive Treeview

Sort array of objects by key


/*
     !Sort array of objects by key
     =======================================
     Implementation:
                     arrayObj  = [{name:"james",sortOrder: 2},{name:"john",sortOrder: 1}];
                     arrayObj.sort((a, b) => sortArrayObjByKey(a, b, 'sortOrder'));
                     //* Output: [{name:"john",sortOrder: 1}{name:"james",sortOrder: 2}]
  */
  sortArrayObjByKey(aanybanykeystring) {
    return a[key] - b[key];
  }

Comments

Top Posts

SQL Server Symmetric Key & Certificate based Encryption With AES_256 Algorithm

Kendo Grid Angular Column Width, minResizableWidth dynamic

Kendo Grid AutoFit Columns