Why does the assignment operator return a value and not a reference?
<p>I saw the example below explained on this <a href="http://joseanpg.net/jslab/quiz/soshnikov/answers.html" rel="nofollow">site</a> and thought both answers would be 20 and not the 10 that is returned. He wrote that both the comma and assignment returns a value, not a reference. I don't quite understand what that means. </p>

<p>I understand it in relation to passing variables into functions or methods i.e primitive types are passed in by value and objects by reference but I'm not sure how it applies in this case.</p>

<p>I also understand about context and the value of 'this' (after help from stackoverflow) but I thought in both cases I would still be invoking it as a method, foo.bar() which would mean foo is the context but it seems both result in a function call bar(). </p>

<p>Why is that and what does it all mean?</p>

<pre><code>var x = 10;
var foo = {
  x: 20,
  bar: function () {return this.x;}
};

(foo.bar = foo.bar)();//returns 10
(foo.bar, foo.bar)();//returns 10
</code></pre>
