输入:[2, [2, 8, 34343, 2, [3, 2, 78]], [1, 2]]
输出:[ 2, 2, 8, 34343, 2, 3, 2, 78, 1, 2 ]
function dealData (arr) {
if (Object.prototype.toString.call(arr) !== '[object Array]') {
return;
}
return `${arr}`.split(',').map(Number);
}
let arr = [2, [2, 8, 34343, 2, [3, 2, 78]], [1, 2]];
let res = dealData(arr);
console.log(res); // [ 2, 2, 8, 34343, 2, 3, 2, 78, 1, 2 ]