1
//简单数组
function hasDuplicates(a) {
return _.uniq(a).length !== a.length;
}
var a = [1,2,1,3,4,5];
var b = [1,2,3,4,5,6];
document.write(hasDuplicates(a), ',',hasDuplicates(b));
//对象数组
var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
let arr= _.uniqWith(objects, (item1,item2)=>{
retutn item1.x==item2.x&&item1.y==item2.y
});
console.log(arr.length,objects.length)