質問編集履歴
1
期待している結果についての追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,14 +12,26 @@
|
|
12
12
|
|
13
13
|
const obj = [
|
14
14
|
|
15
|
-
{id: 1, quantity: 1, name: 'product1'},
|
15
|
+
{id: 1, quantity: 1, name: 'product1', sample: [0,4]},
|
16
16
|
|
17
|
-
{id: 2, quantity: 3, name: 'product2', sample: [1,2],
|
17
|
+
{id: 2, quantity: 3, name: 'product2', sample: [1,2]},
|
18
18
|
|
19
19
|
]
|
20
20
|
|
21
|
-
console.log(obj.filter(e => e.sample.includes(arr
|
21
|
+
console.log(obj.filter(e => e.sample.includes(arr)))
|
22
22
|
|
23
23
|
// => []
|
24
24
|
|
25
25
|
```
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
指摘事項への追記
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
**期待している結果**
|
34
|
+
|
35
|
+
sampleの中身に対してarrの値がが含まれていれば該当jsonを返します。
|
36
|
+
|
37
|
+
``=> {id: 2, quantity: 3, name: 'product2', sample: [1,2]}``
|