title: Javascript Ternary Operator lvalue
body: <p>I was reading about the ternary operator in different languages, and noticed something interesting in the Javascript section.  <a href="http://en.wikipedia.org/wiki/%3F:#JavaScript" rel="nofollow">http://en.wikipedia.org/wiki/%3F:#JavaScript</a></p>
  
  <blockquote>
    <p>The conditional operator in JavaScript has the same syntax and precedence structure as in the other BCPL-derived variants, but a significant difference exists in the semantics: it returns an <a href="http://en.wikipedia.org/wiki/Value_%28computer_science%29" rel="nofollow">l-value</a>.</p>
  </blockquote>
  
  <p>The first sentence states that the return of the ternary in javascript is an lvalue, so I tried some examples, with odd results (in the chrome console).</p>
  
  <p>Given:</p>
  
  <pre><code>var a = { 'yo' : 'momma' }
  var b = { 'yo' : 'cool' }
  var bool = true
  
  
  (bool? a : b).yo = 'LLJ'
  //a is now { 'yo' : 'LLJ' }
  
  (bool? a.yo : b.yo) = 'LLJ' //throws a reference error
  </code></pre>
  
  <p>Why does the first work and the second fail? (Logically they're the same statements, no?)</p>