1var arrOfObj = [
2 {
3 id:1 ,name:'abc',age:27
4 },
5 {
6 id:2 ,name:'pqr',age:27
7 },
8 {
9 id:1 ,name:'abc',age:27
10 },
11 ]
12
13var setObj = new Set(); // create key value pair from array of array
14
15var result = arrOfObj.reduce((acc,item)=>{
16 if(!setObj.has(item.age)){
17 setObj.add(item.age)
18 acc.push(item)
19 }
20 return acc;
21},[]);//converting back to array from mapobject
22
23console.log(result);