Sort Object Array Javascript Function Call