What is wrong with this function Trying to automate add images

fff(e){
    var obj=[]
    var self=this;
    let counter=0
    counter+=e;
function     jj(){

 

   obj[counter]= self.scene.add.image(self.x, self.y, self.frame)
   obj[counter].setInteractive()
   obj[counter].setData('cat1',{ name: 'Red Gem Stone', level: 2, owner: 'Link', 'gold': 50 });
//   var am=  self.scene.tweens.add({targets: obj[counter],
//         x: 750,
//         duration: 8800,
//         ease: 'Linear'
//     })
    obj[counter].on('gameobjectup', function (gameObject){
        console.log('hola')
        var text = self.scene.add.text(350, 270, '', { font: '16px Courier', fill: '#00ff00' });
        text.setText([
            'Name: ' + gameObject.getData('name'),
            'Level: ' +obj[counter].getData('level'),
            'Value: ' + obj[counter].getData('gold') + ' gold',
            'Owner: ' + obj[counter].getData('owner')
        ]);
        gameObject.emit('clicked', gameObject)
    },this)
    let i=obj[counter]
    obj[counter].on('clicked', (onob)=> {
        var text = self.scene.add.text(350, 270, '', { font: '16px Courier', fill: '#00ff00' });
        text.setText([
            'Name: ' + onob.getData('name'),
            'Level: ' +obj[counter].getData('level'),
            'Value: ' + obj[counter].getData('gold') + ' gold',
            'Owner: ' + obj[counter].getData('owner')
        ]);
    self.obv=true
        console.log('ddddddd',counter, onob)
    })
};

jj()

Hi people…
I am just want to check what I am doing wrong currently I get 8 cats in sprites tweened or not is no problem but i want to add info about the cats in the text input, what am I doing wronk?
every text field return undefined but the counter is valid but i tried both the object returned in function and in out helping out please this is the cat class so from creating main I call a new cat in a for loop, so in this function, I want to add the info is it possible?
cheers

It looks like every time you call the fff function you reset the counter, and the inner jj function can only be called by calling the fff function, so the obj array is never populated with more than one item.

okay, I don’t know what I am doing wrong at the moment in devlog chrome the counter is updating correctly now and its 2 registered events… to show the text but all the text fields come up in text ‘undefined’
like so
name: undefined,
level: undefined., etc
I even tried to return this, and return the object is created. or tried to move the text set and get to the main scene nothing works.
I keep trying but some groups uu need refresh I maybe miss something