有些记得不是很清楚。 大概如下:/*@param depth {Number} 嵌套数组的深度,默认值为1*/ Array.prototype.reduceDepth = function(depth){ //写代码地方 } 实例输出: const arr1 = [1,[2,3]]; const arr2=[1,[2,3,[4]]]; const arr3=[1,[2,3,[4]]]; const arr4=[1, ,[3,4]]; console.log(arr1.reduceDepth()); //[1,2,3] console.log(arr2.red...