This question already has an answer here:
这个问题已经有了答案:
- Simplest code for array intersection in javascript 35 answers
- javascript 35中最简单的数组交集代码。
If array A contains all weekdays in Array B, then I want to return True.
如果数组A包含数组B中的所有工作日,那么我想返回True。
var A = ["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY"]; var B = ["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"];
var =[“星期一”,“周二”,“日”,“星期四”,“星期五”);var B =[“星期一”,“周二”,“日”,“星期四”、“星期五”,“星期六”、“星期天”);
1 个解决方案
#1
0
You can do like
你可以像
B.every(e => A.some(f => e == f))
#1
0
You can do like
你可以像
B.every(e => A.some(f => e == f))