Horje
javascript check if elements of one array are in another Code Example
javascript array includes another array
const array1= ["cheese", "dough", "sauce", "pepperoni"]
const array2= ["mozzarella", "peppers", "chicken", "cheese"]

const isIncluded =  array1.some(value => array2.includes(value))
// true

const values = array1.filter(value => array2.includes(value))
// "cheese"
Source: dev.to
javascript check if elements of one array are in another
const found = arr1.some(r=> arr2.includes(r))
javascript check if array is subset of another
let superSet = ['B', 'C', 'A', 'D'];
let subSet = ['D', 'C'];
let mixedSet = new Set([...superSet, ...subSet]);
let isSubset = mixedSet.size == superSet.length
if array ontains any item of another array js
const found = arr1.some(r=> arr2.indexOf(r) >= 0)




Javascript

Related
413 payload too large nodejs Code Example 413 payload too large nodejs Code Example
es6 forEach Code Example es6 forEach Code Example
update node js version ubuntu Code Example update node js version ubuntu Code Example
quotient js Code Example quotient js Code Example
cy url contains Code Example cy url contains Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9