zoukankan      html  css  js  c++  java
  • JS 数组去重

    Array.prototype.unique3 = function(){ //数组去重
    var res = [];
    var json = {};
    for(var i = 0; i < this.length; i++){
    if(!json[this[i]]){
    res.push(this[i]);
    json[this[i]] = 1;
    }
    }
    return res;
    }

    $scope.selectedShops=$scope.selectedShops.unique3();

    js 数组遍历

    for(j in $scope.aggShops){
    if ($scope.aggShops[j].siteId != "ALL") {
    $scope.siteIds.push($scope.aggShops[j].siteId);
    };
    }

    2222222222222

    $scope.aggShops.forEach(function(e){
    if (e.siteId != "ALL") {
    $scope.siteIds.push(e.siteId);
    };
    console.log(e);
    })

  • 相关阅读:
    coder的脚印
    Mysql
    MSDos
    Windows Develop
    Eclipse 使用总结
    DBA常用SQL
    SSH总结
    Unity3D协程
    yield的作用
    UGUI优化
  • 原文地址:https://www.cnblogs.com/kelly007/p/4680503.html
Copyright © 2011-2022 走看看