Optimizing the IF condition
<pre><code>  AddPatient = {};
  if(GenderValue === undefined) {
        AddPatient.Gender = ' ';  
    } else {
        AddPatient.Gender = GenderValue;  
    }
    if(DateOfBirthValue === undefined) {
        AddPatient.DateOfBirth = ' ';  
    } else {
        AddPatient.DateOfBirth = DateOfBirthValue;  
    }
    if(SSNValue === undefined) {
        AddPatient.SSN = ' ';  
    } else {
        AddPatient.SSN = SSNValue;  
    }
    if(RaceValue === undefined) {
        AddPatient.Race = ' ';  
    } else {
        AddPatient.Race = RaceValue;  
    }
    if(ReligionValue === undefined) {
        AddPatient.Religion = ' ';  
    } else {
        AddPatient.Religion = ReligionValue;  
    }
    if(CellPhoneValue === undefined) {
        AddPatient.CellPhoneNumber1 = ' ';  
    } else {
        AddPatient.CellPhoneNumber1 = CellPhoneValue;  
    }
    if(HomePhoneValue === undefined) {
        AddPatient.phonenumber1 = ' ';  
    } else {
        AddPatient.phonenumber1  = HomePhoneValue;  
    }
    if(PrimaryPhoneValue === undefined) {
        AddPatient.PrimaryPhoneNumber = ' ';  
    } else {
        AddPatient.PrimaryPhoneNumber = PrimaryPhoneValue;  
    }
    if(EmailValue === undefined) {
        AddPatient.EmailAddress1 = ' ';  
    } else {
        AddPatient.EmailAddress1 = EmailValue;  
    }
    AddPatient.ResidentialAddress = {};
    if(AddressValue === undefined) {
        AddPatient.AddressLine1 = ' ';  
    } else {
        AddPatient.ResidentialAddress.AddressLine1 = AddressValue;  
    }
    if(CityValue === undefined) {
        AddPatient.City = ' ';  
    } else {
        AddPatient.ResidentialAddress.City = CityValue;  
    }
    if(StateValue === undefined) {
        AddPatient.State = ' ';  
    } else {
        AddPatient.ResidentialAddress.State = StateValue;  
    }
    if(ZipValue === undefined) {
        AddPatient.PostalCode = ' ';  
    } else {
        AddPatient.ResidentialAddress.PostalCode = ZipValue;  
    }
</code></pre>

<p>Is there any better way to write the same code?</p>
