回答編集履歴
2
chousei
answer
CHANGED
@@ -7,5 +7,5 @@
|
|
7
7
|
```
|
8
8
|
ちゃんとやるなら
|
9
9
|
```javascript
|
10
|
-
const result = keyword.filter(x=>types.
|
10
|
+
const result = keyword.filter(x=>types.some(y=>new RegExp(x).test(y)));
|
11
11
|
```
|
1
chousei
answer
CHANGED
@@ -4,4 +4,8 @@
|
|
4
4
|
const keyword = ["天気","よい","太陽"];
|
5
5
|
const result = keyword.filter(x=>new RegExp(x).test(types.join('__sepalator__')));
|
6
6
|
console.log(result);//["天気", "よい"]
|
7
|
+
```
|
8
|
+
ちゃんとやるなら
|
9
|
+
```javascript
|
10
|
+
const result = keyword.filter(x=>types.filter(y=>new RegExp(x).test(y)).length);
|
7
11
|
```
|