This code should work. Use Object.keys
and reduce
, to map
over every value and return the description:
const data = {
1: [
{id: 1, description: "teste", category: 1},
{id: 73, description: "basica tb", category: 1}
],
2: [
{id: 3, description: "Teoria das ideias", category: 2}
],
4: [
{id: 5, description: "Mr with research computer.", category: 4}
],
9: [
{id: 10, description: "Vote drug thus no.", category: 9}
]
}
const getDescription = data => Object.keys(data).reduce((a, key) => ({...a, [key]: data[key].map(o => o.description)}), {})
console.log(getDescription(data))
1
solved how can I show the information of a list object