The simple code below produces RangeError: Maximum call stack size exceeded
const arr = []
for (let i = 0; i < 135000; i++) {
arr.push(i)
}
const arr2 = []
// something else here that changes arr2
arr2.push(...arr)
1) Why does this happen? (I am simply adding element to an array, why does it increase stack size ?)
2) How to fix this error ? (My goal is to create a shallow copy of arr into arr2)