title: Using a variable value to call an array element
body: <p>I have a string variable which contains the name of an array.  What I'd like to do is access an element of that array.  And write it to another variable.  How can I do this?</p>
  
  <pre><code>var sample = new Array();
  sample[0] = 'one';
  sample[1] = 'two';
  
  var arrayname = "sample";
  var number = arrayname[1];  ///  Something like this, although I realize this doesn't work for obvious reasons...
  </code></pre>
  
  <p>I've read other questions in regards to using an variable value as a function, but I didn't understand the approach or even if this would work for the above situation.</p>
  
  <p>Thanks in advance!!</p>