Forum Discussion
^^^
Except that the (hard coded) loop length defines the array size in the above example.
So doing it dynamically is pointless. As you already know in advance it will be 5.
(Handy to know nonetheless as I assume it will be the same in C# Script .... which is what I'm currently using/learning as I go)
Much like the OP where the RowCount can be retrieved and known before the array is declared so dynamic declaration should not be required?
It was just an example to illustrate the idea of dynamic array initialization. JavaScript/JScript arrays are dynamic by design, you can add and remove array elements at any time.
var arr = []; while (condition) { arr.push(element) } arr.pop(); // remove last element arr.splice(3, 1); // remove 1 element at index 3
Reference: JScript Array object
- Colin_McCrae9 years agoCommunity Hero
Yeah. I know.
But it did illustrate beautifully that you don't need to do it dynamically if you know the required size in advance ... :smileylol:
- yurik9 years agoContributor
Thank you everybody for the help!
Related Content
- 2 years ago
Recent Discussions
- 2 days ago