js 数组扁平
// 数组扁平和去重
var arr = [[1,2,2],[3,4,5,5],[6,7,7,9,[11,12,[12,13,[14]]]],10];
function hello (arr) {
let res = []
for (let i = 0; i < arr.length;i++) {
if (Array.isArray(arr[i])) {
res = res.concat(hello(arr[i]))
} else {
res.push(arr[i])
}
}
return [...new Set(res)]
}
hello(arr)