📅  最后修改于: 2022-03-11 15:02:56.942000             🧑  作者: Mango
var array = [{"name":"Joe", "age":17}, {"name":"Bob", "age":17}, {"name":"Carl", "age": 35}];
var unique = [];
var distinct = [];
for(var i = 0; i < array.length; i++ ){
if(!unique[array[i].age]){
distinct.push(array[i]);
unique[array[i].age] = 1;
}
}
gs.info(distinct);