flatern 方法
const arr = [1, 2, 3, [4, 5,['a', 'b']], 6]
function flat(arr) {
isDeep = arr.some(item => item instanceof Array)
if(!isDeep) {
return arr
}
const res = Array.prototype.concat.apply([], arr)
return flat(res)
}
console.log(flat(arr)) // [1, 2, 3, 4, 5, "a", "b", 6]