Horje
check if array exists in another array javascript 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))
How to check if array includes a value from another array in JavaScript
// How to check if array includes a value from another array in JavaScript
const includesAny = (arr, values) => values.some(v => arr.includes(v));
includesAny([1, 2, 3, 4], [2, 9]); // true
includesAny([1, 2, 3, 4], [8, 9]); // false
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
check if array exists in another array javascript
const found = arr1.some(r=> arr2.indexOf(r) >= 0)




Javascript

Related
search string javascript Code Example search string javascript Code Example
jquery clone object Code Example jquery clone object Code Example
date in javascript Code Example date in javascript Code Example
javascript array buffer Code Example javascript array buffer Code Example
what is JSON TREE Code Example what is JSON TREE Code Example

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