I've been having a problem with accessing an array. I want to access the value of an array but all I've been getting is the string name of the array. I've searched the net but have found nothing related to my problem. I've simplified the problem and it looks like this.
var pics = ["one","two","three"];
var index = 1;
var name = "pics";
function changeContent(name)
{
var foo = name+'['+index+']';
alert(foo);
}
All I've been getting is
pics[1]
What I want is the value of pics[1] which is "two". How do you get the value of the array?