var arr1 = ["a","b"]; var arr2 = ["A","B"]; var arr3 = ["1","2"]; //arr = ["a_A","a_B","a_1","a_2","b_A","b_B","b_1","b_2","A_1","A_2","B_1","b_2"]; //arr = ["a_A_1","a_A_2","a_B_1","a_B_2","b_A_1","b_A_2","b_B_1","b_B_2"]; cp = arrs => arrs.reduce((a, b) => { const arr = []; a.forEach(i => { b.forEach(j => { arr.push(i + "_" + j); }); }); return arr; }); console.log(cp([arr1, arr2, arr3]))