I want to access the variable FR[0]. The variable country is "FR". I thought this would do it:
console.log("eval country: " + eval("country"));
console.log("fr0: " + FR[0]);
console.log("eval country0: " + eval("country")[0];
The output is:
eval country: FR
fr0: http://www.example.co.uk/
eval country0: F
What am I doing wrong?
Edit: the clarify: the country variable changes. Sometimes it is FR sometimes it is UK etc etc. I want to it access the appropriate variable based on the string that country contains.
eval()needlessly (this is one of those times). #2, what doFRandcountrylook like?eval(country)would do that, however you could simply docountry = FRso theres no need to use evil eval at all