const inventory = [
{
districtId: "B01",
districtName: "Araria",
employeeId: null,
regionId: "EAST",
regionName: "EAST",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B02",
districtName: "Araria",
employeeId: null,
regionId: "EAST",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B03",
districtName: "Araria",
employeeId: null,
regionId: "EAST",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B04",
districtName: "Araria",
employeeId: null,
regionId: "SOUTH",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B05",
districtName: "Araria",
employeeId: null,
regionId: "WEST",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B06",
districtName: "Araria",
employeeId: null,
regionId: "NORTH",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B04",
districtName: "Araria",
employeeId: null,
regionId: "NORTH",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B05",
districtName: "Araria",
employeeId: null,
regionId: "WEST",
stateId: "BHN",
stateName: "BHN",
userId: "26",
},
{
districtId: "B06",
districtName: "Araria",
employeeId: null,
regionId: "NORTH",
stateId: "BHN",
stateName: "BHN",
userId: "26",
}
];
region = [];
inventory.forEach(element => {
if(!region.find(x => x.regionId == element.regionId ))
{
this.region.push(element)
}
});
console.log(region)
No comments:
Post a Comment