为了账号安全,请及时绑定邮箱和手机立即绑定

js多个数组元素两两组合三三组合

js多个数组元素两两组合三三组合

慕斯709654 2019-04-27 22:16:19
vararr1=["a","b"];vararr2=["A","B"];vararr3=["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"];请问怎么写?
查看完整描述

2 回答

?
慕仙森

TA贡献1827条经验 获得超7个赞

varnewArr1=arr1.map((v,i)=>{
returnarr1[i]+"_"+arr2[i];
});
varnewArr2=arr1.map((v,i)=>{
returnarr1[i]+"_"+arr2[i]+"_"+arr3[i];
});
                            
查看完整回答
反对 回复 2019-04-27
  • 2 回答
  • 0 关注
  • 1771 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信