If you try to iterate through DataCollection and try to remove some of records, not all elemets will be iterated. Some of them will be skipped.
it is normal behavior for collections (lists, arrays).
you should not modify collection during iteration.
instead try to filter required items and then remove them.
I understand what the reason is. But I’m not sure this is the right way.
For example, I can do something like this:
var arr = [1,2,3]; arr.foreach((item, key) => delete arr[key]); console.log(arr);
It will be handled internally so all elements will be iterated.
deleting array’s key does not modify array in the way I mentioned.
it just sets value to undefined
if you try to use
splice(key, 1) you will see the difference.
Yes. You are right. Thank you.