unique
arrayRemoves duplicate elements from an array
Syntax
unique(array) Parameters
array (array) The array to deduplicate
Returns
array A new array with only unique elements
Examples
Input:
[1, 2, 2, 3, 1] | unique Output:
[1, 2, 3] Input:
["a", "b", "a", "c"] | unique Output:
["a", "b", "c"] The unique() function removes duplicate elements from an array, returning a new array containing only the first occurrence of each unique value.
Usage
This function is essential for data deduplication, finding distinct values, and cleaning datasets with repeated entries.