I have this code, but I want to access a attribute of an object that is within an array , but is returning undefined
obj1 = {
nome : 'name',
array : [],
funcao : function(element){this.array.push(element)},
getArray : function(){return this.array},
getNome : function(){this.array.forEach(element =>element.nome) }
}
obj2 = {
nome: 'name2'
}
obj1.funcao(obj2)
console.log(obj1.getArray())
console.log(obj1.getNome())