阅读背景:

判断list数组里的json对象有无重复,有则去重留1个

来源:互联网 

查找有无重复的

var personLength = [{ certType: '2015-10-12', certCode:'Apple'}, { certType: '2015-10-12', certCode:'Apple'}, { certType: '2015-10-13', certCode :'Apple' }]
      var find = false;
      for(var i = 0; i < personLength.length; i++){
          for(var j = i + 1; j < personLength.length; j++){
              if(personLength[i].certType==personLength[j].certType&& personLength[i].certCode==personLength[j].certCode){
                find = true;
                var flagIndex = j;
                break;
              }
          }
          if (find) break;
      }var personLength = [{ certType: '2015



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: