Is there any easier (ES6 preferably) way of getting the unique collection of expense types than below ?
const expenseObjList = [
{id:1, type:"books", title:"print book purchase", amount:50},
{id:2, type:"books", title:"ebook purchase", amount:10},
{id:3, type:"grocery", title:"vegetables", amount:5},
{id:4, type:"grocery", title:"milk", amount:5},
{id:5, type:"grocery", title:"eggs", amount:10}
]
const newArr = expenseObjList.map((item)=>{
return item.type
})
const newSet = new Set(newArr)
console.log('set',newSet)