You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem with the current implementation is that it's prone to stack overflow ("Maximum call stack size exceeded") as the spread operator puts all arguments on stack.
I'd suggest changing it to a less fancy but more stable implementation:
const flatten = (array) => {
let dest = [];
const len = array.length
for(let i = 0; i < len; i++){
dest.push(...array[i])
}
return dest;
};
The text was updated successfully, but these errors were encountered:
Given
flatten
function from utils.js:The problem with the current implementation is that it's prone to stack overflow ("Maximum call stack size exceeded") as the spread operator puts all arguments on stack.
I'd suggest changing it to a less fancy but more stable implementation:
The text was updated successfully, but these errors were encountered: