title: How to access public property from private and public functions in a JavaScript module?
body: <p>I'm wondering how to access a public property from private and public functions in a JavaScript module?</p>
  
  <p>For example, if this is my module:</p>
  
  <pre><code>var PersonModule = (function(){
  
      var sayHello = function(){
          alert("Hello " + name);
      }
  
      var privateChangeNameToBob = function(){
          this.name = "Bob";
      }
  
      var changeName = function(){
          privateChangeNameToBob();
      }
  
      return {
          name: "",
          sayHello: sayHello,
          changeName: changeName
      }   
  })();
  </code></pre>
  
  <p>Neither <code>sayHello</code> or the <code>changeName</code> functions work correctly because I don't know how to access the public <code>name</code> property. Is there a way to do this? I've worked around it by using private variables with getters and setters, but I'm wondering if I can do it without them.</p>