Python Sort Object Array Javascript Iteration