title: Access an array outside of a function
body: <p>I have a shopping cart, within the cart I want to store 4 items for each item </p>
  
  <pre><code>[0] DB id
  [1] description
  [2] cost
  [3] item id
  </code></pre>
  
  <p>So I have whipped up a 2d array</p>
  
  <pre><code>var x=0;
  var items= new Array();
  var itemNum = 0
  
  Function add(id, desc, cost )
  {
  items[x]=new Array(4);
  items[x][0]=item;
  items[x][1]=desc;
  items[x][2]=cost;
  items[x][3]=itemNum;
  x++
  itemNum++
  }
  </code></pre>
  
  <p>How do access the array outside the function?</p>