JavaScript termasuk nilai array dalam properti objek di peta array beberapa

const adminRoles = ['admin', 'captain'];
//----------------------
 let clientIds = [{id:1, roles: 'captain'}, {id:2, roles: 'pilot'}];
 console.log(  
    adminRoles.some((adminRole) => (clientIds.map(x => x.roles).includes(adminRole)))
 )
 // true
//----------------------
let clientIds = [{id:1, roles: '**spy**'}, {id:2, roles: 'pilot'}];
 console.log(  
    adminRoles.some((adminRole) => (clientIds.map(x => x.roles).includes(adminRole)))
 )
 // false
//----------------------
Angry Alpaca