Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
Source by www.30secondsofcode.org #
 
PREVIOUS NEXT
Tagged: #check #elements #array #includes #array #javascript
ADD COMMENT
Topic
Name
9+3 =