On a click event in my application I am returned highlights - an array of features (each time of differing length). So console.log(highlights) produces:
My objective is to return the sum of the values contained in properties.census2010_Pop2010 for each feature in the object. So far I have tried the code below but nothing is returned in the console. Any suggestions would be appreciated.
total = Object.create(null);
highlights.feature.properties.forEach(function (a) {
a.census2010_Pop2010.forEach(function (b) {
total = total + b.census2010_Pop2010;
});
});
console.log(total);

totalas an object? Don't you want it to be a number?census2010_Pop2010"for each feature in the object", but eachFeaturein the object only has a singleproperties.census2010_Pop2010entry, so "summing" doesn't come into it...?