title: Does JavaScript allow getters and setters?
body: <p>this is my code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var Note=function(){}
  Note.prototype = {
      get id()
      {
          if (!("_id" in this))
              this._id = 0;
          return this._id;
      },
  
      set id(x)
      {
          this._id = x;
      }
  }
  
  var a=new Note()
  alert(a.id)
  &lt;/script&gt;
  </code></pre>
  
  <p>this style is like to python ,</p>
  
  <p>this is my first time to see this code ,</p>
  
  <p>and can you give me more example about 'get' and 'set' in javascript  .</p>
  
  <p>thanks</p>