function repeatCount(result,threshold){
var arr = [];
var counts = 0;
result.sort()
for (var i = 0; i < result.length;) {
var count = 0;
for (var j = i; j < result.length; j++) {
if (result[i].mobile === result[j].mobile) {
count++;
}
}
arr.push({
date: result[i].mobile,
count: count
})
i+=count;
}
for (var k = 0; k < arr.length; k++) {
if(arr[k].count>=threshold){
counts ++;
}
}
return counts;
}
//下面是调用
var result = [{"name":"孙强","mobile":"1"},{"name":"刘寒","mobile":"1"},{"name":"孙梦","mobile":"2"},{"name":"李海飞","mobile":"2"}];
console.log(repeatCount(result,2));