I need to access an array of feature attributes that is nested inside an item list object. It looks like this.
var itemsList = {
_searchedFeatures: {
Wildlife Management Areas: [{}, {}, {}]
}
}
I need to access the Wildlife Management Areas(WMA) array and loop through it, extract an attribute value from each feature in the array and push that value to another array. The problem I am having is that I cannot access the WMA array.
I have tried using a combination of dot notation and bracket notation to get to the WMA array, but I always get undefined. I know the WMA is there and contains a list of objects because I can see them when I access the _searchFeatures object.
I have tried
itemList._searchedFeatures
which returns the array. I can see the array in the chrome console, but I need to get to the values inside or the array.
Chrome console: Searched Features
{}
Wildlife Management Areas: (5) [c, c, c, c, c] //I need to get to this
array!
This code is not working:
itemsList._searchedFeatures["Wildlife Management Areas"];
I am expecting to see an indexed list of features that looks something like this:
0: {...}
1: {...}
2: {...}
But instead, I just get undefined. What is interesting, is when I hover the mouse over Wildlife Management Areas in the console, I am seeing what looks to be the JavaScript dot notation solution, but I don't know how to duplicate it. This is what I am seeing:
[""Wildlife Management Areas""]
I have never seen double double quotes and this will obviously not work, but I have no idea how to interpret this. Please let me know what I am not understanding.