回答編集履歴
3
補足
test
CHANGED
@@ -35,4 +35,13 @@
|
|
35
35
|
|
36
36
|
- codepen 👉 https://codepen.io/su507/pen/NWMVxzZ?editors=0012
|
37
37
|
|
38
|
+
### 補足
|
38
39
|
|
40
|
+
配列を集合とみなして、2つの配列が表す集合の差集合に相当する配列を得るときに、lodash の [difference](https://lodash.com/docs/#difference) が便利です。これを使って、以下
|
41
|
+
|
42
|
+
- codepen 👉 https://codepen.io/su507/pen/poVmyWP?editors=0012
|
43
|
+
|
44
|
+
では、MDN英語版のjavascriptの説明の冒頭文 `JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.` から母音に相当するアルファベットを除去した文字列を作っています。
|
45
|
+
|
46
|
+
|
47
|
+
|
2
コード修正
test
CHANGED
@@ -28,9 +28,9 @@
|
|
28
28
|
また、同じ正規表現を使って`福岡市中央区港1-2-34- 567`を得るには、以下のようにします。
|
29
29
|
|
30
30
|
```javascript
|
31
|
-
const concatABWithout
|
31
|
+
const concatABWithoutCommonPart = str.replace(regexp, (_, p1, p2) => `${p1}${p2}`);
|
32
32
|
|
33
|
-
console.log(concatABWithout
|
33
|
+
console.log(concatABWithoutCommonPart); // '福岡市中央区港1-2-34- 567'
|
34
34
|
```
|
35
35
|
|
36
36
|
- codepen 👉 https://codepen.io/su507/pen/NWMVxzZ?editors=0012
|
1
誤字修正
test
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
```
|
26
26
|
|
27
27
|
|
28
|
-
また、同じ正規表現を使って`福岡市中央区港
|
28
|
+
また、同じ正規表現を使って`福岡市中央区港1-2-34- 567`を得るには、以下のようにします。
|
29
29
|
|
30
30
|
```javascript
|
31
31
|
const concatABWithoutDiffB = str.replace(regexp, (_, p1, p2) => `${p1}${p2}`);
|