find the variable which is equal to the value of another variable
<p>I came across a confusing fact during coding a script.</p>

<p>How can i find the variable which is equal to the value of another variable. THEN , get the value of that variable.</p>

<p>Here's an example:</p>

<pre><code>var result;
var 1 = "john";
var 2 = "amy";
var 3 = "micheal";

var info = "1";
</code></pre>

<p>When var info is set to <code>1</code> , the script will then look for variable 1 which has the value <code>JOHN</code> then get the value <code>john</code> . Then set the result's value to "john".</p>

<p>For the same thing ,</p>

<p>When var info is set to <code>2</code> , the script will then look for variable 2 which has the value <code>AMY</code> then get the value <code>amy</code> . Then set the result's value to "amy".</p>

<p>and so on..</p>

<p>My info variable's value is not determined. it could be 1 , 2 or 3 which is set/determined by an user event.</p>

<p>P/S i can use if and else , but i want to know how this can be done. :)</p>

<p>So how can i do this?</p>
