difference
Returns the difference between two arrays (items in first array but not in second).
null and undefined are treated as empty arrays:
difference(null, b) → []; difference(a, null) → copy of a.
Available since v1.9.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
array1 | readonly T[] | null | undefined | First array |
array2 | readonly T[] | null | undefined | Second array |
Returns
Section titled “Returns”T[] — Array with items from first array not present in second array
Examples
Section titled “Examples”Get items only in the first array
Section titled “Get items only in the first array”Returns elements present in the first array but not in the second.
