回答編集履歴
3
再帰処理を封印
test
CHANGED
@@ -25,3 +25,11 @@
|
|
25
25
|
const A =(a,...b)=>'文字'+a+(b.length>1?A(...b):b);
|
26
26
|
|
27
27
|
```
|
28
|
+
|
29
|
+
再帰が評価されないようなので
|
30
|
+
|
31
|
+
```js
|
32
|
+
|
33
|
+
console.log(test.reduceRight((x,y)=>'文字'+y+x));
|
34
|
+
|
35
|
+
```
|
2
短くも
test
CHANGED
@@ -17,3 +17,11 @@
|
|
17
17
|
const A =(a,...b)=>'文字'+(b.length>1?a+A(...b):a+b);
|
18
18
|
|
19
19
|
```
|
20
|
+
|
21
|
+
さらに
|
22
|
+
|
23
|
+
```js
|
24
|
+
|
25
|
+
const A =(a,...b)=>'文字'+a+(b.length>1?A(...b):b);
|
26
|
+
|
27
|
+
```
|
1
短く
test
CHANGED
@@ -9,3 +9,11 @@
|
|
9
9
|
console.log(A (...test));
|
10
10
|
|
11
11
|
```
|
12
|
+
|
13
|
+
じゃもう少し短く
|
14
|
+
|
15
|
+
```js
|
16
|
+
|
17
|
+
const A =(a,...b)=>'文字'+(b.length>1?a+A(...b):a+b);
|
18
|
+
|
19
|
+
```
|