I have an array of cluster, where each cluster contains a set of features. I use two forEach statements to iterate through the clusters and features in order to store each feature in my "result" array. 

I need to further process my "result" array. But when I ask for the length of the array, it is stated, that the length is 0, although I can see in the console that there are features in it. I need to find a way to only process the "result" array when the forEach loops are finished. 

I have read about this problem being caused through asynchronus data processing in JavaScript. I already tried to register a Promise, but I cannot get it to work, because in the examples always one forEach loop is used, but I have two forEach loops within each other.

This is my code:

```
var result = [];

clusters.forEach((cluster) => {
  getFeatures(cluster_id, (features) => {
  features.forEach((feature) => {
    result.push(feature);
  });
  });
});

//do something with result array
console.log("resulting features array length: " + result.length); //results in 0

```