I'm sending a string as parameter to a function, but i already have a global variable in that name, i want to get the value of that variable but its sending as undefined..
My example code
i have a array as reg[0][0],reg[0][1],reg[1][0],reg[1][0],reg[2][0],reg[2][1]
and i have some global variables as tick1, tick2, tick3...
it will either have the values as 0,1 or 2
and in a function i called
calc_score(id) //id will return as either tick1,tick2,tick3
{
alert(eval("reg[id][1]")); // it should return the value of reg[0][1] if id is 0
}
But its not working.
The id wont be a numeral it will be string .. So how can i do this?