intersection
Compute the intersection of two arrays, meaning the elements that are present
in both arrays.
null and undefined are treated as empty arrays and return [].
Available since v1.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | readonly T[] | null | undefined | First array |
b | readonly T[] | null | undefined | Second array |
Returns
Section titled “Returns”T[] — The intersection of the two arrays
Examples
Section titled “Examples”Find common elements
Section titled “Find common elements”Returns elements present in both arrays.
