unique
Modified on Fri, 18 Aug 2023
Description
Return the new duplicate free array.
Syntax
unique(array)
Parameters
Input Parameter | Type | Description |
---|---|---|
array | Array | The array to inspect |
Return value
Type |
---|
Array<any> |
Sample
Example | Result | Description |
---|---|---|
unique([1, 2, 2, 3]) | [1, 2, 3] | Returns an array with unique values |
unique([{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]) | [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] | Returns an array with unique objects |
To view all the List functions, click here.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article