title: How do I make a Global Variable in JavaScript?
body: <p>So I would like for dashboard to be able to be modified inside one function, then be displayed in another function. Kind of like a public variable in java. Is this possible? See my code below.</p>
  
  <pre><code>var dashboard = new Array();
  function init() {
      getXML(); //1.  goto get XML 2.// XML Parser
      displayXML();
  }
  
  function getXML() {
      console.log("getXML REACHED");
      $.ajax({
          type: "GET",
          url: "file:///H:/ModelDisplayV1/ModelDisplayV1/files/dashboard.xml",
          dataType: "xml",
          success: xmlParser
      });
  }
  
  function xmlParser(xml) {
      dashboard[0] = 7;
      console.log(dashboard);
  });
  }
  
  function displayXML() {
      console.log("display xml function reached!!!");
      console.log(dashboard);
  }
  </code></pre>
  
  <p>When I finally try and get the <code>console.log(dashboard)</code> it says <code>dashboard is undefined</code>. I thought by declaring dashboard outside of my functions it would be global. How do I make it so I can alter the contents of dashboard in one function and retrieve them in another function?</p>
  
  <p>I am more familiar with Java as opposed to Javascript.</p>