title: Store and get value from one function to another function
body: <p>I have a <code>html</code> page and I'm calling a <code>javascript</code> function from the html page and the script is in separate file</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;a href="javascript:void(0);" id="btn1" onclick="ButtonClick();"&gt;Click Me&lt;/a&gt;
  &lt;script src="Externalscript.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      Initialize('1,2,3,4');
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>var myList;  //global variable
  function Initialize(ids) {
  myList = new Array();
  var idList = ids.split(',');
  for (i = 0; i &lt; idList.length; i++) {
      myList.push(idList[i]);
  }
  </code></pre>
  
  <p>I'm storing the ids value in <code>myList</code> and now I want to retrieve the myList when the button clicked</p>
  
  <pre><code> function ButtonClick() {
      alert(myList);
  }
  </code></pre>
  
  <p>Now, when I'm trying to alert the myList it is giving <code>undefined</code>.</p>
  
  <p>How can store the values in a <code>global</code> variable and retrieve in other function</p>