title: Unable to access public JavaScript object var
body: <p>I have a class that starts like this:</p>
  
  <pre><code>function event()
  {
      this.event_id = null;
  </code></pre>
  
  <p>and then it all gets populated with an init function.</p>
  
  <p>In another part of my script I can not access these variables.</p>
  
  <p>If I run this code:</p>
  
  <pre><code>    console.log(my_event);
      console.log(my_event.event_id);
  </code></pre>
  
  <p>For the first line the console gives me a nice representation of the event object with the event_id populated, but for the second line it gives me null.</p>
  
  <p>What's going on?  The variable should be public right?</p>
  
  <p>Many thanks for any help.</p>