Is it possible to smooth an array with a length of 700,000 records without exceeding the call stack?

I am trying to smooth a huge array of 100,000 elements, I am smoothing it twice because it is 2d and I want to get all the objects inside the 2nd array: [ [ {} ] ]

I tried using shorthand and using concat, for example:

Concat. firstFlat is processed within a second. secondFlat causes the maximum call stack to be exceeded.

let firstArray = Array(100000).fill(Array(7).fill({}));
let firstFlat = [].concat.apply([], firstArray);
let secondFlat = [].concat.apply([], firstFlat);

Reduce. Call stack also exceeded

let array = Array(100000).fill(Array(7).fill({}))
                         .reduce((x, y) => x.concat(y))
                         .reduce((x, y) => x.concat(y))
                         .reduce((x, y) => x.concat(y));

, , , , . , "" . ? , . , callstack 1 1 . , ? , , , , , , : function a() {a()}, , , . forEach/for. callstack? Concat - , ? .

!

: Object.assign. . , , async,

+4
2

. "".

let firstArray = Array(100000).fill(Array(7).fill({}));
Array.prototype.concat(...firstArray) // (700000) [...]

.

"" - :

Array.prototype.concat(firstArray[0], firstArray[1], ..., firstArray[699999]);

.

+1

OP , " " , tbh. :

firstArray = Array(100000).fill(Array(7).fill({}));
let list = [];
for(let i = 0; i < firstArray.length; i++)
    for(let j = 0; j < firstArray[i].length; j++) 
        list.push(firstArray[i][j]);

( - :))

@MathRobin , , : P

+1

Source: https://habr.com/ru/post/1691844/