title: How to declare variables in javascript
body: <p>Sorry for the newb question. But I have been trying for hours.</p>
  
  <pre><code>var dbruns = {}; // namespace
  
  dbruns.dbstuff = {
      var nameslistresult = [];
  </code></pre>
  
  <p>This gets an error, unexpected identifier. When I put it at the dbruns level</p>
  
  <pre><code>var dbruns = {}; // namespace
  var nameslistresult = [];
  dbruns.dbstuff = {
  </code></pre>
  
  <p>It gets past there, but then</p>
  
  <pre><code>console.log(typeof dbruns.nameslistresult);
  console.log(typeof dbruns.dbstuff.nameslistresult);
  </code></pre>
  
  <p>both return undefined.</p>
  
  <p>I really have no idea what is going on here, and any help would be appreciated.</p>