title: What does a function with multiple return statements return?
body: <p>This is from an exercise out of Head First JavaScript Programming book.</p>
  
  <pre><code>    function findCarInLot(car) {
              for (var i = 0; i &lt; lot.length; i++) {
                  if (car === lot[i]) {
                      return i;
                  }
              }
              return -1;
          }
  
      var lot = [chevy, taxi, fiat1, fiat2];
  </code></pre>
  
  <p>I'm not going to write all the code basically the chevy, taxi, etc, are objects and the function is assigned one of the four objects and that value is give to a variable in this exercise. My question is what is going on with: </p>
  
  <pre><code>    return -1;
  </code></pre>
  
  <p>So doesn't that get returned when the function completes? Or is it negated when</p>
  
  <pre><code>    return i;
  </code></pre>
  
  <p>happens? Or are both values returned? Could someone sort this out for my poor brain and tell me what the rules are here.</p>