Last active
April 10, 2020 03:39
-
-
Save C0D4-101/03b39dc330aa721e486189cb0ab69c32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildMap(regions) { | |
var caseMap = []; | |
for (i = 0; i < regions.length; i++) { | |
caseMap[regions[i]] = 0; | |
} | |
return caseMap; | |
} | |
function populateMap(regions, source) { | |
for (key in source) { | |
regions[key] = source[key]; | |
} | |
return regions; | |
} | |
var source = { "Alabama": 1, "Arizona": 2, "Colorado": 3, "Mississippi": 5 }; | |
var listOfRegions = ['Alabama', 'Alaska', 'American Samoa', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'District of Columbia', 'Federated States of Micronesia', 'Florida', 'Georgia', 'Guam', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Marshall Islands', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Northern Mariana Islands', 'Ohio', 'Oklahoma', 'Oregon', 'Palau', 'Pennsylvania', 'Puerto Rico', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virgin Island', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']; | |
var caseMap = populateMap(buildMap(listOfRegions), source); | |
console.log(caseMap); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment