JavaScript Example Data - U.S. State Names And Abbreviations

March - 2022

Array of state objects

const states = [{"id": "AL", "name": "Alabama"}, {"id": "AK", "name": "Alaska"}, {"id": "AZ", "name": "Arizona"}, {"id": "AR", "name": "Arkansas"}, {"id": "CA", "name": "California"}, {"id": "CO", "name": "Colorado"}, {"id": "CT", "name": "Connecticut"}, {"id": "DE", "name": "Delaware"}, {"id": "FL", "name": "Florida"}, {"id": "GA", "name": "Georgia"}, {"id": "HI", "name": "Hawaii"}, {"id": "ID", "name": "Idaho"}, {"id": "IL", "name": "Illinois"}, {"id": "IN", "name": "Indiana"}, {"id": "IA", "name": "Iowa"}, {"id": "KS", "name": "Kansas"}, {"id": "KY", "name": "Kentucky"}, {"id": "LA", "name": "Louisiana"}, {"id": "ME", "name": "Maine"}, {"id": "MD", "name": "Maryland"}, {"id": "MA", "name": "Massachusetts"}, {"id": "MI", "name": "Michigan"}, {"id": "MN", "name": "Minnesota"}, {"id": "MS", "name": "Mississippi"}, {"id": "MO", "name": "Missouri"}, {"id": "MT", "name": "Montana"}, {"id": "NE", "name": "Nebraska"}, {"id": "NV", "name": "Nevada"}, {"id": "NH", "name": "New Hampshire"}, {"id": "NJ", "name": "New Jersey"}, {"id": "NM", "name": "New Mexico"}, {"id": "NY", "name": "New York"}, {"id": "NC", "name": "North Carolina"}, {"id": "ND", "name": "North Dakota"}, {"id": "OH", "name": "Ohio"}, {"id": "OK", "name": "Oklahoma"}, {"id": "OR", "name": "Oregon"}, {"id": "PA", "name": "Pennsylvania"}, {"id": "RI", "name": "Rhode Island"}, {"id": "SC", "name": "South Carolina"}, {"id": "SD", "name": "South Dakota"}, {"id": "TN", "name": "Tennessee"}, {"id": "TX", "name": "Texas"}, {"id": "UT", "name": "Utah"}, {"id": "VT", "name": "Vermont"}, {"id": "VA", "name": "Virginia"}, {"id": "WA", "name": "Washington"}, {"id": "WV", "name": "West Virginia"}, {"id": "WI", "name": "Wisconsin"}, {"id": "WY", "name": "Wyoming"}]

Object with abbreviations as keys

const states = { AL: 'Alabama', AK: 'Alaska', AZ: 'Arizona', AR: 'Arkansas', CA: 'California', CO: 'Colorado', CT: 'Connecticut', DE: 'Delaware', FL: 'Florida', GA: 'Georgia', HI: 'Hawaii', ID: 'Idaho', IL: 'Illinois', IN: 'Indiana', IA: 'Iowa', KS: 'Kansas', KY: 'Kentucky', LA: 'Louisiana', ME: 'Maine', MD: 'Maryland', MA: 'Massachusetts', MI: 'Michigan', MN: 'Minnesota', MS: 'Mississippi', MO: 'Missouri', MT: 'Montana', NE: 'Nebraska', NV: 'Nevada', NH: 'New Hampshire', NJ: 'New Jersey', NM: 'New Mexico', NY: 'New York', NC: 'North Carolina', ND: 'North Dakota', OH: 'Ohio', OK: 'Oklahoma', OR: 'Oregon', PA: 'Pennsylvania', RI: 'Rhode Island', SC: 'South Carolina', SD: 'South Dakota', TN: 'Tennessee', TX: 'Texas', UT: 'Utah', VT: 'Vermont', VA: 'Virginia', WA: 'Washington', WV: 'West Virginia', WI: 'Wisconsin', WY: 'Wyoming' }

Array of sorted array of abbreviations:

const states = ['AK', 'AL', 'AR', 'AZ', 'CA', 'CO', 'CT', 'DE', 'FL', 'GA', 'HI', 'IA', 'ID', 'IL', 'IN', 'KS', 'KY', 'LA', 'MA', 'MD', 'ME', 'MI', 'MN', 'MO', 'MS', 'MT', 'NC', 'ND', 'NE', 'NH', 'NJ', 'NM', 'NV', 'NY', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VA', 'VT', 'WA', 'WI', 'WV', 'WY']

Array of states as objects with abbreviation as the key

const states = [
  { AK: 'Alaska' }, { AL: 'Alabama' }, { AR: 'Arkansas' }, { AZ: 'Arizona' }, { CA: 'California' }, { CO: 'Colorado' }, { CT: 'Connecticut' }, { DE: 'Delaware' }, { FL: 'Florida' }, { GA: 'Georgia' }, { HI: 'Hawaii' }, { IA: 'Iowa' }, { ID: 'Idaho' }, { IL: 'Illinois' }, { IN: 'Indiana' }, { KS: 'Kansas' }, { KY: 'Kentucky' }, { LA: 'Louisiana' }, { MA: 'Massachusetts' }, { MD: 'Maryland' }, { ME: 'Maine' }, { MI: 'Michigan' }, { MN: 'Minnesota' }, { MO: 'Missouri' }, { MS: 'Mississippi' }, { MT: 'Montana' }, { NC: 'North Carolina' }, { ND: 'North Dakota' }, { NE: 'Nebraska' }, { NH: 'New Hampshire' }, { NJ: 'New Jersey' }, { NM: 'New Mexico' }, { NV: 'Nevada' }, { NY: 'New York' }, { OH: 'Ohio' }, { OK: 'Oklahoma' }, { OR: 'Oregon' }, { PA: 'Pennsylvania' }, { RI: 'Rhode Island' }, { SC: 'South Carolina' }, { SD: 'South Dakota' }, { TN: 'Tennessee' }, { TX: 'Texas' }, { UT: 'Utah' }, { VA: 'Virginia' }, { VT: 'Vermont' }, { WA: 'Washington' }, { WI: 'Wisconsin' }, { WV: 'West Virginia' }, { WY: 'Wyoming' }
]