if I have:
x=3;
FirstNames = ["John","Paul","George","Ringo"];
LastNames = ["Smith","Jonson","Jones","Doe"];
SemiRandomNumbers= [3,6,7,4,2,1,0,9];
I can set: ArrayToUse = FirstNames; alert(ArrayToUse[x]); // > "Ringo"
I know it's weird, but it's how I set it up. My problem lies in:
ArrayToUse DOES NOT = FirstNames, It = "John","Paul","George","Ringo"
I want to: alert( "The Array used Was: " +ArrayToUse+ "." ); and I want the result to be:
"The Array Used Was: FirstNames."
I don't want the result:
"The Array Used Was: John","Paul","George","Ringo."
SO...... I know it sounds silly, but, is there a predefined property of an object that contains the name of the object?
i.e. ArrayToUse.name -> FirstNames. ??? (currently undefined)
is there a property I am unaware of for this use? or, would I have to set it up on my own like: FirstNames = ["John","Paul","George","Ringo"]; FirstNames.name="FirstNames";
I hate to go through the trouble/filespace/bandwidth if it already exists.
Before anyone says: "Answered elsewhere" I admit I HAVE seen similar questions, BUT.. after several hours, I keep finding the answer to work backwards. i.e. the poster tells you how to make a NEW variable with the name of the variable being the string contents of the array, and the poster warns them to ONLY use existing arrays. This is the EXACT OPPOSITE of what I am looking for/asking.
I want to grab the NAME of an object/array in string form, NOT the contents of the array/object.