I'm trying to import a set of coordinates from an external javascript.
I have to include about 78.740 elements in the constructor, but firefox just throws an error:
"too many constructor arguments"
Does anybody have any ideas?
This is my code:
function CreateArray() { return new Array( ... ... ... 78.740 elements later ... ); }
In the Java edition of Building Maintainable Software, Joost Visser advises keeping the number of parameters to no more than four. The same guideline probably applies to almost all other programming languages, like C#, Scala and even FORTRAN and COBOL.
There are two techniques that can be used to reduce a functions' arguments. One of them is to refactor the function, making it smaller, consequently, reducing the arguments' number. The Extract Method technique can be use to achieve this goal.
This method has four parameters: the loan amount, the interest rate, the future value and the number of periods.
Try array literal, it worked for me (tested with success for million items):
function CreateArray() {
return [
...
];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With