var ary = [];
var obj = {}
obj.kpiName = "1";
obj.kpiWeight = "1";
obj.kpiDesc = "1";
ary.push(obj);
var obj1 = {}
obj1.kpiName = "3";
obj1.kpiWeight = "2";
obj1.kpiDesc = "2";
ary.push(obj1);
console.log(isRepeat(ary))
// 判断kpiName是否存在重复的
function isRepeat(arr) {
var hash = {};
for(var i in arr) {
debugger;
if(hash[arr[i].kpiName]) {
return true;
}
hash[arr[i].kpiName] = true;
}
return false;
}