Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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);
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now