Ruby Array Sort Method Javascript