I have 2 json files statesCode.json and cityAndzipCode.json having following structure
statesCode.json
{ "Alabama" : "AB" ,
"Alaska" : "AS" ,
}
cityAndzipCode.json
{ "Alabama" : { city : "Birmingham" , zipcode : "123456" },
"Alaska" : { city : "Anchorage" , zipcode : "453567" },
---
}
now in my component I am returning stateAbbreviation , cityName and zipCode . I have to write a condition that if we get only stateAbbreviation in url and cityName and zipCode are null, then we have to check the list in cityAndzipCode.json and return city and zipCode as array .
I was able to apply this logic, kindly tell me what am I doing wrong
if ( url . zipCode === null && info . cityName === null && url . stateAbbreviation )
{
if ( url . stateAbbreviation === stateCodes ) {
url . cityName = stateCodes ;
url . zipCode = stateCodes [ 1 ];
}
Aucun commentaire:
Enregistrer un commentaire