Js笛卡尔乘积

  self.getDescartesSku = function (selSaleProp, i, nowLst, allALst) {
        if (selSaleProp.length == 0) {
            return;
        }
        if (i == selSaleProp.length - 1) {
            for (var tempi = 0; tempi < selSaleProp[i].values.length; tempi++) {
                var tempA = nowLst.concat(selSaleProp[i].values[tempi]);
                allALst.push({ SaleProps: tempA });
            }
        } else {
            for (var tempi = 0; tempi < selSaleProp[i].values.length; tempi++) {
                var tempA = nowLst.concat(selSaleProp[i].values[tempi]);
                self.getDescartesSku(selSaleProp, (i + 1), tempA, allALst);
            }
        }
    };

版权声明:本文为博主原创文章,未经博主允许不得转载。

posted @ 2015-07-24 15:10  liningit  阅读(463)  评论(0编辑  收藏  举报