function unique(arr) {
return Array.from(new Set(arr))
}
Array.from() 是把类数组转换成数组
console.log(unique(arr)) [1,2,'a']