Let's dive into the complexities of my current project. I am delving deep into U.S. Census bureau information, specifically focusing on a snippet of data from an object that looks like this: (Remember, this is only a portion of the complete object.)
Object {MTFCC: "G5020", OID: 207903717468543, GEOID: "13135050431", STATE:
"13", COUNTY: "135"…}
AREALAND: 5416158
AREAWATER: 34463
B19013_001E: "45543"
The key element capturing my interest is B19013_001E, denoting the code for Median Household Income. To pinpoint the exact Median household income figure, I would use:
response.features[1].properties.B19013_001E
All seems to be functioning smoothly so far. However, here lies my dilemma: I aim to interchange that code with other values. For instance, if someone wishes to inquire about median_male_age, represented by the code B01002_002E, I want to steer clear of hard-coding in B01002_002E as follows:
response.features[1].properties.B01002_002E
This method would indeed yield results. Yet, I desire a more dynamic approach that hinges on a variable rather than statically inputting the particular code. Thus, envision a setup akin to this hypothetical scenario:
var value = prompt("What do you want to look at: ")
//Here, 'value' would assume the special code inputted by the user, such as B01002_002E.
console.log(response.features[1].properties.value)
Regrettably, all my attempts in this direction have been met with silence. Initially, I suspected a mismatched data type, but upon deliberation, I don't think that's the root cause (I experimented with number conversion and string manipulation). Any insights on resolving this conundrum would be immensely appreciated!