Remove method problem

For some reason remove method miss some items is this right way to use it

function CleanVisualization() {

    const Items  = Sceneinfo.Scene.children;

 

    for (let index = 0; index < Items.length; index++) {

        const Item = Items[index];

        if(Item.Visulization == "Visulization"){

            Sceneinfo.Scene.remove(Item);

            console.log(Item.name +' removed');

        } 

    }

}

The problem here is that you’re iterating over an array with an index, while pulling things out of that array at the same time. Each time something is removed from the array, the next item moves into its slot, but the loop never revisits that index.

Some workarounds would be to either iterate over the child array in descending order, or put the items to be removed into an empty list first, and then remove them in a second step.