I want to access all the buttons i created, but i can only access the last one. The first console.log() (nr1), gives me the textContent of all the buttons that i press. But the last console.log() only "works" (or gives me) with the last button/textContent (the last object in the array).
            opt.onclick = function(){
                for(item of arr){
                    let btn = document.createElement('button')
                    let btnText = document.createTextNode(item.name)
                    btn.appendChild(btnText)
                    forum.appendChild(btn)
                    btn.onclick = function(){
                        console.log(btn.textContent) //Nr.1
                        if(btn.textContent === item.name){
                            console.log(item.name) //Nr.2
                        }
                    }
                }
            }
