3👍
✅
You can do like this
const itemList = [
{product: "banana", quantity: "0", price: "32"}
{product: "tomato", quantity: "1", price: "45"}
{product: "mango", quantity: "2", price: "56"}
]
console.log(itemList.map(item => item.product))
1👍
Using LODASH
const itemList = [
{product: "banana", quantity: "0", price: "32"},
{product: "tomato", quantity: "1", price: "45"},
{product: "mango", quantity: "2", price: "56"}
]
const items = _(itemList)
.map('product')
.value();
alert(items)
Source:stackexchange.com