I have a string array variable called ‘myAttachmentArray[]’ which holds different figures like this:
[0] – 50000
[1] – 51010
[2] – 52000
[3] – 50010
And the array size is dependent on an int variable called ‘squadNumbers’
What I want to do, is to place all the ‘myAttachmentArray[]’ into another string variable called ‘currentAttachments’, but with a ‘,’ in between each array value.
So, currentAttachments would = 50000,51010,52000,50010 …
The only problem is that the array size is dynamic, so I can’t do:
currentAttachments = myAttachmentArray[0]+”,”+myAttachmentArray[1]…
So I tried a for loop:
for(var i = 0; i <= (squadNumbers - 1); i++){
currentAttachments = currentAttachments + myAttachmentArray[i] + ",";
}
But I still don’t get what I want …Please help
You need to use join