I have this array of objects.
[
{
tier1: "Normal",
tier2: "none",
tier3: "none",
tier4: "none",
tier5: "none",
},
{
tier1: "Urgent",
tier2: "GCC & Labour",
tier3: "new",
tier4: "Cancellation",
tier5: "Cancellation",
},
{
tier1: "Urgent",
tier2: "Foreigner",
tier3: "renew",
tier4: "Cancellation",
tier5: "none",
},
]
I need to get tier1, tier2, tier3 tier4 and tier5 values only single time.
So suppose in the above example tier1 has Normal one time and Urgent two times so it will be removed in the next element. tier5 has none in the first element so will be reomved from the last element as it already exists.
Output will be
[
{
tier1: "Normal",
tier2: "none",
tier3: "none",
tier4: "none",
tier5: "none",
},
{
tier1: "Urgent",
tier2: "GCC & Labour",
tier3: "new",
tier4: "Cancellation",
tier5: "Cancellation",
},
{ tier2: "Foreigner", tier3: "renew" },
]