SOURCE

let names = ["iPhone X", "iPhone XS"];
let colors = ["黑色", "白色"];
let storages = ["64g", "256g"];
let combine = function (...chunks) {
    let res = [];
    let helper = function (chunkIndex, prev) {
        let chunk = chunks[chunkIndex];
        let isLast = chunkIndex === chunks.length - 1;
        for (let val of chunk) {
            console.log("111")
            console.log(prev)
            let cur = prev.concat(val);
            if (isLast) {
                // 如果已经处理到数组的最后一项了 则把拼接的结果放入返回值中 
                res.push(cur)
                console.log(res)
            } else { helper(chunkIndex + 1, cur) }
        }
    } // 从属性数组下标为 0 开始处理 // 并且此时的 prev 是个空数组 
    helper(0, [])
    return res
}
console.log(combine(names, colors, storages))
console 命令行工具 X clear

                    
>
console