2.判断是否存在对象: arr.forEach(item=>{ if(item.name=='Alex'){ alert('存在这个元素'); } }) 1. 2. 3. 4. 5.
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 =...