Sort Object Array Javascript Function Parameters