I have a script which grabs window.location, splits it and then puts part of it into a string. The script also defines a number of arrays.
I want to use the string to pull elements out of the associated array (assuming it exists). For example, if the string value is "X" I want to pull elements from the array that is called X, e.g. the elements X[0], X[1] etc.
The problem is that I can't simply write X[0] as X is a string. How can I relate the string value to the name of the array?
I want to use the string to pull elements out of the associated array (assuming it exists). For example, if the string value is "X" I want to pull elements from the array that is called X, e.g. the elements X[0], X[1] etc.
The problem is that I can't simply write X[0] as X is a string. How can I relate the string value to the name of the array?