[SOLVED] Implement 'for' loop on attribute

thanks
but now the line console.log("hello"+this.Objects[i].script.PositionThis.myIndex); throws an error “cannot read property index of undefined”.
i went by this post

where you wrote this.otherEntity.script.script2.printCount.
where is the diference?

the caller script has
SelectionMouseInput.attributes.add ('Objects', { type: 'entity', array: true, title: 'Objects to select' });

the array is assigned with entities that each has the PositionThis script.
position this has this attribute
PositionThis.attributes.add('myIndex', { type: 'number' });

https://playcanvas.com/editor/scene/784107