-2
let myObject = {
nome: 'Nome',
idade: 20,
endereco: {
rua: 'Tal',
numero: 5,
municipio: {
codigo: 1,
ibge: '001'
}
}
};
Object.keys(myObject)
.forEach((key) => {
console.log(key);
// 'nome', 'idade', 'endereco'
});
I want to be able to make a given method, receive an object and be able to iterate all properties, even if they are chained. It is possible?
Hi Vitor, can you translate the question into English? Do you want to iterate internal properties recursively, is that it? which application do you want to achieve?
– Sergio
Yes, that’s right, Sergio. Basically this, I want a possible method to receive an object and be able to identify all property values, even if the parsing property carries another object, you know? I ended up sending in English without noticing that it was on the Portuguese page. It was bad.
– Vitor Marcolino