newId is not needed anymore because you are using that you want. Or you could use it instead of obj.uid in next line

indexByPhone(obj, newId);