Skip to main content
Participating Frequently
September 24, 2016
Question

What would be the best way to call two arrays (identical structure, just different values)?

  • September 24, 2016
  • 1 reply
  • 317 views

What would be the best way to incorporate a second array with (identical structure, just different values)?

So by entering a value in a form field, and depending on that value, it would either call the first or second array to use in a calculation.

Would it be best to define multiple arrays in a document level javascript?

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
September 24, 2016

Your question is not very clear, but sure, you can define as many arrays as you want in the doc-level.

If the arrays have the same structure and length then you can iterate one of them and use the index of the item you're interested in for the other. For example:

var array1 = ["A", "B", "C", "D"];

var array2 = [65, 66, 67, 68];

for (var i=0; i<array1.length; i++) {

     if (array1=="B") app.alert("The number matching B is: " + array2);

}