title: JavaScript get/set methods vs. standard methods
body: <p>Why does JavaScript have two different ways to get/set object properties?</p>
  
  <p>Example:</p>
  
  <pre><code>//implementation 1
  var obj1 = {
    "x":1,
    get number() {return this.x},
    set number(n) {this.x = n}
  }
  
  //implementation 2
  var obj2 = {
    "x":1,
    getX: function(){return this.x},
    setX: function(n){this.x = n}
  }
  </code></pre>
  
  <p>Does one implementation style have advantages over the other?</p>