title: Javascript "if" Order of Operations
body: <p>So let's say you have a really basic person object with two values and one function:</p>
  
  <pre><code>function personObject() {
      this.name = 'First Name';
      this.placeInLine = 1;
      this.setPlaceInLine = function(place) {
          this.placeInLine = place;
      }
  }
  </code></pre>
  
  <p>And we setup some variables like this:</p>
  
  <pre><code>var john = new personObject();
  var bill = new personObject();
  var message = "";
  </code></pre>
  
  <p>Now look at the three codes snippets below...</p>
  
  <p>---Code #1---</p>
  
  <pre><code>if(john.placeInLine &lt; bill.placeInLine) message = "John is before Bill";
  else message = "John is not before Bill";
  </code></pre>
  
  <p>RESULT: message = "John is not before Bill"; // because 1 is not less than 1</p>
  
  <p>---Code #2---</p>
  
  <pre><code>bill.setPlaceInLine(2); // change Bill's place to 2 (instead of default of 1)
  if(john.placeInLine &lt; bill.placeInLine) message = "John is before Bill";
  else message = "John is not before Bill";
  </code></pre>
  
  <p>RESULT: message = "John is before Bill"; // because 1 less than 2;</p>
  
  <p>---Code #3---</p>
  
  <pre><code>if(john.placeInLine &lt; bill.setPlaceInLine(2)) message = "John is before Bill";
  else message = "John is not before Bill";
  </code></pre>
  
  <p>RESULT: message = "John is not before Bill": // why?</p>
  
  <p>Is the .setPlaceInLine function being called after the comparison?  Or is the act of running that function returning something that is then being compared to john.placeInLine?</p>