I am facing a requirement where I must check for duplicates among object items.
Within the following Array of objects, I need to specifically look for duplicates in either the "empno" or "extension" properties. If any duplicates are found, an error should be triggered.
I attempted using this Stack Overflow link as a reference, but unfortunately, it did not provide the solution I needed.
[
{
"id": 269,
"empno": "34567",
"extension": 345
},
{
"id": 269,
"empno": "34568",
"extension": 346
},
{
"id": 269,
"empno": "34569",
"extension": 345
},
{
"id": 269,
"empno": "34567",
"extension": 345
}
]