SOURCE

var arr=[1,2,[3,4,[5,6,7]],9,[10,11]];
function steamroller(arr) {
  if(arr.length <= 1){
    return arr;
  }
  var brr = [];
  for(i=0;i<arr.length;i++){
		if(typeof(arr[i]) == 'Array'){
      brr.push(steamroller(arr[i]));
    }else{
      brr.push(arr[i]);
    }
  }
  return brr;
}

function steamroller1(arr){
  if(arr.length <= 1) {
    return arr;
  }
  var brr = [];
  for(i=0;i<arr.length;i++){
		if(typeof(arr[i]) == 'Array'){
      for(j=0;j<arr[i].length;i++){
        if(typeof(arr[i][j]) == 'Array'){
          brr.concat(arr[i][j]);
        }else{
          brr.push(arr[i][j]);
        }
      }
    }else{
      brr.push(arr[i]);
    }
  }
  return brr;
}
console.log(steamroller1(arr));
console 命令行工具 X clear

                    
>
console