Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript include array value in an object property in an array map some

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
//----------------------
Comment

PREVIOUS NEXT
Code Example
Javascript :: chain underscore 
Javascript :: the given sign-in provider is disabled for this firebase project 
Javascript :: settimeout and create directory nodejs 
Javascript :: track call recording in facebook using elements 
Javascript :: PAN SNAP 
Javascript :: Any array in JSON object is not empty 
Javascript :: Node.js with Express: Importing client-side javascript using script tags in Jade views 
Javascript :: remember me option in firebase + react 
Javascript :: TypeError: table.fnFilter is not a function 
Javascript :: Using Bind() With BuiltIn JavaScript Function 
Javascript :: javascript datamatrix parser 
Javascript :: Odoo Javascript Modules 
Javascript :: Sending An AJAX Request Using Ky 
Javascript :: phaser matrix rotate 
Javascript :: convert json date to java date 
Javascript :: js redirection captive portal 
Javascript :: jquery ajax success function not executing 
Javascript :: Javascript Area When Base and Height is Known 
Javascript :: repeated click onchange javascript 
Javascript :: give call suggestions while clicking on a contact number in next js 
Javascript :: javascript call function change last default value 
Javascript :: function titleCase 
Javascript :: mongodb function example 
Javascript :: JSON of first block in cryptocurrency blockchain 
Javascript :: how to render react quill the way it is without the html tags 
Javascript :: site:stackoverflow.com how to see all react dependencies 
Javascript :: how to delete array filter in react hooks 
Javascript :: cookies javascript 
Javascript :: dom traversal jquery 
Javascript :: jsx attributes 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =