Need to get the value of a variable which is sent as a string?
<p>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..</p>

<p>My example code</p>

<p>i have a array as reg[0][0],reg[0][1],reg[1][0],reg[1][0],reg[2][0],reg[2][1]</p>

<p>and i have some global variables as tick1, tick2, tick3...</p>

<p>it will either have the values as 0,1 or 2</p>

<p>and in a function i called </p>

<pre><code>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

}
</code></pre>

<p>But its not working.</p>

<p>The id wont be a numeral it will be string .. So how can i do this?</p>
