sort by id in array of objects javascript