Javascript 如何检查数组中的任何元素是否包含在另一个数组中
我有两个对象数组。我需要检查项目是否包含在另一个数组中。如果其中一个不包含,则将为falseJavascript 如何检查数组中的任何元素是否包含在另一个数组中,javascript,arrays,Javascript,Arrays,我有两个对象数组。我需要检查项目是否包含在另一个数组中。如果其中一个不包含,则将为false const arr = [ {full_name: 'Test'}, {full_name: 'Test1'}, {full_name: 'Test2'}, ] const arr1 = [ {full_name: 'Test'}, {full_na
const arr = [
{full_name: 'Test'},
{full_name: 'Test1'},
{full_name: 'Test2'},
]
const arr1 = [
{full_name: 'Test'},
{full_name: 'Test1'},
{full_name: 'Test2'},
{full_name: 'Test3'},
{full_name: 'Test4'},
{full_name: 'Test5'},
{full_name: 'Test6'},
]
如果arr1包含测试,Test1 Test2将为true,如果其中一个不包含测试,则Test2将为false
const arr = [
{full_name: 'Test'},
{full_name: 'Test1'},
{full_name: 'Test2'},
]
const arr1 = [
{full_name: 'Test'},
{full_name: 'Test1'},
{full_name: 'Test2'},
{full_name: 'Test3'},
{full_name: 'Test4'},
{full_name: 'Test5'},
{full_name: 'Test6'},
]
我想我需要一些运算符我的方法是使用each和一些数组函数:
const arr=[
{全名:'Test'},
{全名:'Test1'},
{全名:'Test6'},
]
常数arr1=[
{全名:'Test'},
{全名:'Test1'},
{全名:'Test2'},
{全名:'Test3'},
{全名:'Test4'},
{全名:'Test5'},
{全名:'Test6'},
]
console.log(arr.every)(项=>{
返回arr1.some(i2=>i2.full\u name==item.full\u name)
}))
尝试搜索重复的问题。