Add / Remove images to div

Hi, I want to add images and remove it but the problem is when i log the variable its length is change.

//Ui.js
1.images length is 3 if i don’t include for loop
console.log(this.myStaticDeleteImages);

2.But images length is 2 in there assume that number = 1. I don’t understand scenario why the length is equal to 2. I delete images after logging it.

console.log(this.myStaticDeleteImages);
 for (var i=0; i<number; i++){
        this.myStaticDeleteImages[i].parentNode.removeChild(this.myStaticDeleteImages[i]);
 }

//Main.js

this.main = app.root.findByName('Root');
var adder = this.main.script.ui;
adder.addScore(url, number);