回答編集履歴

2

ちょうせい

2021/04/23 07:21

投稿

yambejp
yambejp

スコア116734

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  // var arr3 = arr1.map((x,y)=>x+" "+arr2[y]);
8
8
 
9
- var arr3 = arr1.map((x,y)=>[x,arr2[y]].join(' '));
9
+ var arr3 = arr1.reduce((x,y,z)=>(x.push(`${y} ${arr2[z]}`),x),[]);
10
10
 
11
11
  console.log(arr3);
12
12
 

1

chousei

2021/04/23 07:21

投稿

yambejp
yambejp

スコア116734

test CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  var arr2 = ['Taro', 'Ichiro', 'Ken'];
6
6
 
7
- var arr3 = arr1.map((x,y)=>x+" "+arr2[y]);
7
+ // var arr3 = arr1.map((x,y)=>x+" "+arr2[y]);
8
+
9
+ var arr3 = arr1.map((x,y)=>[x,arr2[y]].join(' '));
8
10
 
9
11
  console.log(arr3);
10
12