Sort Array Javascript Object Restructuring Investment