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.

1.images length is 3 if i don’t include for loop

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.

 for (var i=0; i<number; i++){


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