Forum Discussion
Colin_McCrae
Community Hero
^^^
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?
HKosova
9 years agoSmartBear Alumni (Retired)
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
Related Content
Recent Discussions
- 4 days ago
- 5 days ago