i have an array with objects and i need to get just the values(not the keys) of the object "tipo".
const productsArray = [
{
id: 1,
title: "Tacos",
price: 30,
score: 40,
description: "Delicioso taco con barbacoa recien salida del horno sobre dos tortilla de maiz",
tipo: {
campechano: 25,
costilla:25,
cspaldilla:25,
lomo:25,
maciza:25,
panza:25,
pescuezo:25,
surtida:25
}
},
{
id: 2,
title: "Kilogramos",
price: 500,
score: 89,
description: "Delicioso kilo de barbacoa hecha al horno con leña y sin hueso",
tipo: {
campechano: 500,
costilla:50,
cspaldilla:50,
lomo:50,
maciza:50,
panza:50,
pescuezo:50,
surtida:50
}
},
{
id: 3,
title: "Consome",
price: 50,
score: 25,
description: "Delicioso Consome de Borrego con arroz y garbanzo",
tipo: {
chicho: 30,
grande: 50
}
}
]
i tried these:
for (let key in productsArray){
console.log(`${key}${productsArray[key]}`);
}
but i get
0[object 0bject]
1[object 0bject]
2[object 0bject]
instead of: 25 25 25 25 25 25 25 25 500 500 500 500 500 500 500 500 30 50 i can't figure out how to get these outputs, some tips?