<html>
<body>
<script type="text/javascript">
let arr =[
{demo1:123,demo2:"第一行"},
{demo1:123,demo2:"第二行"},
{demo1:345,demo2:"第三行"},
{demo1:345,demo2:"第四行"},
{demo1:456,demo2:"第伍行"}
]
var map = {};
for(var i=0;i<arr.length;i++){
if(map.hasOwnProperty(arr[i].demo1)){
var x = map[arr[i].demo1];
x = x+1;
map[arr[i].demo1]=x;
}else{
map[arr[i].demo1]=1;
}
}
console.log(JSON.stringify(map))
for(var j=0;j<arr.length;j++){
if(map[arr[j].demo1]>1){
console.log("aaa:"+arr[j].demo1);
}else{
console.log("bbb:"+arr[j].demo1);
}
}
</script>
</body>
</html>