![]() |
VOOZH | about |
The unique() method is used to return the all of the unique values in the collection.
Syntax:
collect(array).unique()
Parameters: The collect() method takes one argument that is converted into the collection and then unique() method is applied on it.
Return Value: This method returns all of the unique items in the collection.
Below example illustrate the unique() method in collect.js:
Example 1:
Output:
[1, 2, 3, 4, 5]
Example 2:
Output:
[
{name: "Kripamoy", dob: "03-03-98", score: 94, section: "A"},
{name: "Biltu", dob: "23-01-96", score: 85, section: "B"}
]