an object array
const menu = [
{
name: "pancakes",
category: "breakfast",
},
{
name: "burger",
category: "lunch",
},
{
name: "steak",
category: "breakfast",
},
{
name: "bacon",
category: "breakfast",
},
];
this is returning an undefine array but when curly braces removed it's working fine.
const categories = menu.map((item)=>{item.category});
console.log(categories);