Answers for "how to get only one element of an array which is present in another array in javascript"

10

javascript check if elements of one array are in another

const found = arr1.some(r=> arr2.includes(r))
Posted by: Guest on March-26-2020
0

how to check all elements in array includes in another array javascript

// how to check all elements in array includes in another array javascript
const includesAll = (arr, values) => values.every(v => arr.includes(v));
includesAll([1, 2, 3, 4], [1, 4]); // true
includesAll([1, 2, 3, 4], [1, 5]); // false
Posted by: Guest on January-03-2022

Code answers related to "how to get only one element of an array which is present in another array in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language