|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
667 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Computes the symmetric difference between two arrays. The symmetric difference is the set of elements
|
|---|
| 3 | * which are in either of the arrays, but not in their intersection.
|
|---|
| 4 | *
|
|---|
| 5 | * @template T - The type of elements in the array.
|
|---|
| 6 | * @param {T[]} arr1 - The first array.
|
|---|
| 7 | * @param {T[]} arr2 - The second array.
|
|---|
| 8 | * @returns {T[]} An array containing the elements that are present in either `arr1` or `arr2` but not in both.
|
|---|
| 9 | *
|
|---|
| 10 | * @example
|
|---|
| 11 | * // Returns [1, 2, 5, 6]
|
|---|
| 12 | * xor([1, 2, 3, 4], [3, 4, 5, 6]);
|
|---|
| 13 | *
|
|---|
| 14 | * @example
|
|---|
| 15 | * // Returns ['a', 'c']
|
|---|
| 16 | * xor(['a', 'b'], ['b', 'c']);
|
|---|
| 17 | */
|
|---|
| 18 | declare function xor<T>(arr1: readonly T[], arr2: readonly T[]): T[];
|
|---|
| 19 |
|
|---|
| 20 | export { xor };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.