JS二维数组去重

//  var temp; 
  //  var count; 
  //  for (var i = 0; i < that.mousePoint.length; i++) { // 第一次遍历数组,确保数组里的子数组都能被检测
  //   temp = that.mousePoint[i]; // 存储被检测的当前子数组
  //   for (var k = 0; k < that.mousePoint.length; k++) {
  //    if (k != i && that.mousePoint[k].length == temp.length) { // 第二次遍历数组,检测除了被检测数组本身以及两者长度不一样的子数组
  //     count = 0; // 初始化
  //     for (var j = 0; j < that.mousePoint[k].length; j++) { // 遍历检测的子数组
  //      if (that.mousePoint[k][j] == temp[j]) {
  //       count++;  // 记录检测子数组与被检测子数组中的元素重复次数
  //      }
  //     }
  //     if (count == temp.length) { // 如果次数与被检测子数组的长度相等,代表两者重复
  //      that.mousePoint.splice(k,1); // 删除该重复元素
  //      k--; // 数组长度变化,K需要减一回到当前位置
  //     }
  //    }
  //   }
  //   console.log("mousePoint "+that.mousePoint);
  //   that.mouseStr.push(that.mousePoint);
  //   console.log("mouseStr "+that.mouseStr);
  //   that.mouseData=[];
  //   that.mousePoint=[];
  //   console.log(1111);
  //  }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值