Checks if the subset array is entirely contained within the superset array.
subset
superset
The type of elements contained in the arrays.
The array that may contain all elements of the subset.
The array to check against the superset.
true
false
const superset = [1, 2, 3, 4, 5];const subset = [2, 3, 4];isSubset(superset, subset); // true Copy
const superset = [1, 2, 3, 4, 5];const subset = [2, 3, 4];isSubset(superset, subset); // true
const superset = ['a', 'b', 'c'];const subset = ['a', 'd'];isSubset(superset, subset); // false Copy
const superset = ['a', 'b', 'c'];const subset = ['a', 'd'];isSubset(superset, subset); // false
Alias