Guest User

Untitled

a guest
Mar 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. function compareBy(a, b) {
  2. return (a || b) ? (!a ? -1 : !b ? 1 : a.localeCompare(b)) : 0;
  3. }
  4.  
  5. array.sort((a, b) => compareBy(a.prop1, b.prop1) || compareBy(a.prop2, b.prop2) || etc...);
Add Comment
Please, Sign In to add comment