I'm experiencing a rare problem when working with an array in Angular that I struggled with for several hours. I have this code here:
console.log(partner.myArray);
partner.myArray.forEach(e => {
console.log(e);
console.log('_____________________________');
});
The first console output shows an empty array, as you can see here:
but when iterating over the same array and printing each element, it somehow shows some entries:
I struggled with that for a long time and now I'm pushing each element into a new array before using it, because I haven't found another solution. I'd really like to know how this can be, because I never had such a problem in typescript. Does anybody have an explanation for that?