kerr
15 years agoOccasional Contributor
Array functions
Hi,
Could you please tell me how to work with arrays in TestComplete using JScript, like I'm 5 years old?
I figured that I can initialize a new array like this:
aWords = new Array("apple", "bee", "cover", "blahblahblah")
and that I can get an array's length like this
iLength = aWords["length"]
and iterate like this
for (i = 0; i < aWords["length"]; i++)
{ DoSomething(aWords) }
But now I can't figure out how to
1) find an item in an array - first occurence/all occurences
2) compare 2 arrays "by value"
3) copy an array "by value"
4) check that an item belongs to an array
5) remove an item from an array
6) add an item to an array
7) add all items from one array to another
I mean, are there some Array functions that allow to do this stuff, or should I write them by myself?
Could you please tell me how to work with arrays in TestComplete using JScript, like I'm 5 years old?
I figured that I can initialize a new array like this:
aWords = new Array("apple", "bee", "cover", "blahblahblah")
and that I can get an array's length like this
iLength = aWords["length"]
and iterate like this
for (i = 0; i < aWords["length"]; i++)
{ DoSomething(aWords) }
But now I can't figure out how to
1) find an item in an array - first occurence/all occurences
2) compare 2 arrays "by value"
3) copy an array "by value"
4) check that an item belongs to an array
5) remove an item from an array
6) add an item to an array
7) add all items from one array to another
I mean, are there some Array functions that allow to do this stuff, or should I write them by myself?
Hi Kerr,
The great age to start reading MSDN Library. :)Could you please tell me how to work with arrays in TestComplete using JScript, like I'm 5 years old?
Here is the MSDN Library section that describes how to work with arrays in JScript: Array Object (Windows Scripting - JScript)
Please let me know if you cannot find answers to any of your questions.