js 二维组数组装规格 无限级
function combination(arr) { var sarr = [[]]; var result = []; for (var i = 0; i < arr.length; i++) { var tarr = []; for (var j = 0; j < sarr.length; j++){ for (var k = 0; k < arr[i].length; k++){ tarr.push(sarr[j].concat(arr[i][k])); } } sarr = tarr; } for(var m =0; m < sarr.length;m++) { result.push(sarr[m].join('.')); } return result; } var garr = [["a","b"],["1","2"],["红色","白色"],["大型","小型"]]; var result = combination(garr); console.log(result);