_.uniq([3, 1, 2, 1, 4, 3, 2, 5]); // Returns [3, 1, 2, 4, 5]
var users = [ { name: 'John', age: 32 }, { name: 'Mary', age: 25 }, { name: 'John', age: 32 }, { name: 'Peter', age: 42 }, { name: 'Mary', age: 25 }, ]; var uniqueUsers = _.uniq(users, function(user) { return user.name; }); // Returns [{ name: 'John', age: 32 }, { name: 'Mary', age: 25 }, { name: 'Peter', age: 42 }]In this example, we have an array of user objects, and we want to remove any duplicate users based on their name property. We use the uniq function with a callback function that extracts the name property from each user object. The uniq function is part of the underscore.js library.