介绍数组扁平化是指将多维数组或嵌套数组转换成一维数组的操作。在 JavaScript 中,你可以使用不同的方法来实现数组扁平化直接上代码 Array.prototype.custom = function () { let flat = [] for (let item of this) { if (Array.isArray(item)) { flat = flat.concat(item.custom()) } else { flat.push(item) } } return flat } let arr = [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10, 11...