If you change the structure of clientProjectsHash , sorting becomes easier. But I'm not sure how you use clientProjectsHash . So my suggestion could be a performance issue in incompatible browsers.
var clientProjectsHash = []; clientProjectsHash[0] = {key: 4, name: 'Alterna Savins & Credit Union', projects: {}}; clientProjectsHash[1] = {key: 5, name: 'BDC', projects: {}}; clientProjectsHash[2] = {key: 3, name: 'BELL', projects: {}}; clientProjectsHash[3] = {key: 6, name: 'BNC', projects: {}}; function sorter(a, b) { if( a.name < b.name ) return -1; if( a.name > b.name ) return 1; return 0; } clientProjectsHash.sort(sorter);
I assume that you saved the key values โโas an object key for quick access. But now the loops are faster. So, you can try such decisions and decide where to go, instead of going hard and suffering.
Good luck.
user405398
source share