|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
725 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Creates an array of unique values from all given arrays.
|
|---|
| 3 | *
|
|---|
| 4 | * This function takes two arrays, merges them into a single array, and returns a new array
|
|---|
| 5 | * containing only the unique values from the merged array.
|
|---|
| 6 | *
|
|---|
| 7 | * @template T - The type of elements in the array.
|
|---|
| 8 | * @param {T[]} arr1 - The first array to merge and filter for unique values.
|
|---|
| 9 | * @param {T[]} arr2 - The second array to merge and filter for unique values.
|
|---|
| 10 | * @returns {T[]} A new array of unique values.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * const array1 = [1, 2, 3];
|
|---|
| 14 | * const array2 = [3, 4, 5];
|
|---|
| 15 | * const result = union(array1, array2);
|
|---|
| 16 | * // result will be [1, 2, 3, 4, 5]
|
|---|
| 17 | */
|
|---|
| 18 | declare function union<T>(arr1: readonly T[], arr2: readonly T[]): T[];
|
|---|
| 19 |
|
|---|
| 20 | export { union };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.