var test = [123,"webank",[1,2,3],"123",{a:1},"tencent",123,[1,2,3],{a:1}]; var unique = (arr) => { var obj = {}; return arr.filter(function(item,index,arr) { return obj.hasOwnProperty(typeof item + item) ? false : (obj[typeof item + item] = true); }) } console.log(unique(test));