How To Sort An Array Based On An Objects Value In Javascript