What is the fastest way, in terms of readability / input, to assign a value to a specific variable based on a related variable?
var abbrev; if(state=='Pennsylvania'){ abbrev='PA'; }else if(state=='New Jersey'){ abbrev='NJ'; }else if(state=='Delaware'){ abbrev='DE'; } //and so on...
I am trying to avoid creating one array for the state name and another array for the abbreviation because the connection is lost with individual declarations.
source share