What is the maximum assignable length of an array in node.js? Why do these errors occur?
"FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory"
This error occurs when I execute this code.
const answer = [];
for (let i = 0; i < 20000; i++) {
for (let j = 0; j < 20000; j++) {
answer.push(1);
}
}
I think it means that the length that can be assigned to the array is exceeded. Then, what is the maximum allocation length of an array in node.js?
Thanks!!! :)