i had array of objects and in each object had category and if any duplicate category is there i have to show only one object.
Here is my array.
const costItems= [
{
amount: 1000,
category: 'Appliances',
instructions: '',
subcontractor: [Object],
thresholdAmount: null,
thresholdPercent: null
},
{
amount: 500,
category: 'Appliances',
instructions: '',
subcontractor: [Object],
thresholdAmount: null,
thresholdPercent: null
},
{
amount: null,
category: 'Appraisal',
instructions: '',
subcontractor: [Object],
thresholdAmount: null,
thresholdPercent: null
},
{
amount: null,
category: 'Building Permit',
instructions: '',
subcontractor: [Object],
thresholdAmount: null,
thresholdPercent: null
}
]
How can i remove duplicate category from array of objects ?