xor es-toolkit
Creates a new array with elements that exist in only one of two arrays.
Usage
xor(arr1, arr2)
Use xor when you want to find the symmetric difference of two arrays. It returns a new array consisting of elements that exist in only one of the two arrays and not in their intersection.
Duplicate elements are automatically removed.
Parameters
arr1readonly T[]required
The first array to compare.
arr2readonly T[]required
The second array to compare.
Returns
Returns a new array representing the symmetric difference of the two arrays.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.