Here is the example of what I am doing:
var size = new Array("S", "M", "L", "XL", "XXL");
var color =
You can't. The array doesn't have a name.
You just have two references to the array, one in the variable and another in the third array.
There is no way to find all the references that exist for a given object.
If the name is important, then store it with the data.
var size = { data: ["S", "M", "L", "XL", "XXL"], name: 'size' };
var color = { data: ["Red", "Blue", "Green", "White", "Black"], name: 'color' };
var options = [size, color];
Obviously you'll have to modify the existing code which accesses the data (since you now have options[0].data[0]
instead of options[0][0]
but you also have options[0].name
).