title: understanding Javascript grammar: user = user | | this.getUser()
body: <p>For context you can find the full class definition @ <a href="https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch6.md" rel="nofollow noreferrer">https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch6.md</a></p>
  
  <p>I am trying to understand this particular expression found under "Simpler Design"</p>
  
  <p><code>LoginController.prototype.validateEntry = function(user,pw) {
      user = user || this.getUser(); //this is the statement I can't follow
      pw = pw || this.getPassword();
  </code></p>
  
  <p>If <code>user = undefined</code> or <code>user = ""</code>, then <code>user = user //false</code>. For any string values <code>user = user //true</code>. But in these cases <code>user = user;</code> evaluates to the same value as simply <code>user;</code></p>
  
  <p>1) is there any added functionality by writing <code>user = user;</code> instead of just <code>user</code>;?</p>
  
  <p>2) why is the JavaScript engine able to evaluate a LHS assignment as a boolean value?</p>