title: What does a return statement do inside a setter?
body: <p>I have the following code:</p>
  
  <pre><code>var o = {};
  o.a = 1;
  
  var _value = 1;
  Object.defineProperty(o,"a",{
      set: function(value){
          _value = value + 1;
          console.log("log: ", value, _value);
          return _value;
      },
      get: function(){
          return _value;
      }
  });
  </code></pre>
  
  <p>In the setter method, I increment <code>_value</code> by one before returning it. So if I set <code>o.a = 5</code>, I would expect the console to print <code>6</code> (even though I realize that returning a value from setter doesn't make sense, usually). However, as the following snippet shows, the console prints <code>5</code>: </p>
  
  <pre><code>&gt; o.a = 5;
  log: 5 6 // from console.log;
  5 // return; why does it == value and not value + 1?
  &gt; o.a;
  6
  &gt; var i = o.a = 5;
  &gt; i;
  5
  &gt; o.a;
  6
  </code></pre>
  
  <p>So my question is why does it return <code>5</code> and not <code>6</code>?</p>
  
  <p>I hope this is not because I made some silly mistake in the code.</p>