title: How do I call out a value in an Array
body: <p>How do I get an Array value out of a function?</p>
  
  <p>This worked:</p>
  
  <pre><code>var days = new Array();
  days[1] = 'Sunday';
  days[2] = 'Monday';
  days[3] = 'Tuesday';
  days[4] = 'Wednesday';
  days[5] = 'Thursday';
  days[6] ='Friday';
  days[7] = 'Saturday';
  alert(days[3]); // returns Tuesday
  </code></pre>
  
  <p>But if I put this in a function how do I get the alert() to work?</p>
  
  <pre><code>function mydays(){
  var days = new Array();
  days['Sunday'] = 1;
  days[8] = 'Monday';
  days[3] = 'Tuesday';
  days[4] = 'Wednesday';
  days[5] = 'Thursday';
  days[6] ='Friday';
  days[7] = 'Saturday';
  }
  alert(mydays(days[8])) //nothing should be Monday
  alert(days[8]) // nothing should be Monday
  </code></pre>
  
  <p>What is the correct syntax?
  Thank you.</p>