I used API calls GET JSON data, filtering it and pushing objects into a new array. However, the elements of the array are undefined types instead of objects.
function filterDataAtSource(city, vacTypeFilters) {
var filteredFeatures = [];
getData().then(function (geojson) {
var features = geojson.features
features.forEach(element => {
if (element.properties.City === city) {
console.log("type of element :", typeof (element));
filteredFeatures.push(element);
}
});
})
console.log("typeof child:", typeof (filteredFeatures[0])); /* undefined type here */
}