found this answer here : post 1
var zones = [
{zone:'A' : price:'20'},
{zone:'B' : price:'20'},
{zone:'C' : price:'20'},
{zone:'A' : price:'20'},
];
unique = [...new Set(zones.map(propYoureChecking =>
propYoureChecking.zone))];
if (unique.length === 1) {
console.log(unique);
}
and for normal arrays : post 2
You can do it a few different ways: here's one (from the post):
const arry = [1, 2, 1, 3, 4, 3, 5];
const toFindDuplicates = arry => arry.filter((item, index) => arr.indexOf(item) !== index)
const duplicateElementa = tofindDuplicates(arry);
onsole.log(duplicateElements);
// Output: [1, 3]