回答編集履歴

1

追記

2021/09/21 05:23

投稿

yambejp
yambejp

スコア116738

test CHANGED
@@ -9,3 +9,21 @@
9
9
  console.log(result);
10
10
 
11
11
  ```
12
+
13
+
14
+
15
+ # isAとisBだけチェック
16
+
17
+ ```javascript
18
+
19
+ const a1 = [{isA:true,isB:false,isC:true},{isA:false,isB:true,isC:true}];
20
+
21
+ const a2 = [{isA:true,isB:false,isC:true},{isA:true ,isB:true,isC:false}];
22
+
23
+ const func=arg=>{let res;return [...new Set(res = arg.map(x=>Object.entries(x)).flat().filter(x=>['isA','isB'].includes(x[0])&&x[1]).map(x=>x[0]))].length==res.length};
24
+
25
+ console.log(func(a1));
26
+
27
+ console.log(func(a2));
28
+
29
+ ```