1.朴素转换
function reduceDimension(arr) {
var reduced = [];
for (var i = 0; i < arr.length; i++) {
for (var j = 0; j < arr[i].length; j++) {
reduced.push(arr[i][j]);
}
}
return reduced;
}
2.concat数组拼接
function reduceDimension(arr) {
var reduced = [];
for (var i = 0; i < arr.length; i++){
reduced = reduced.concat(arr[i]);
}
return reduced;
}
3.apply(thisArg,[argsArray])
function reduceDimension(arr) {
return Array.prototype.concat.apply([], arr);
}