title: Why and how does this "for..in" statement work?
body: <p>I'm learning JavaScript via CodeCademy and am on the "Contact List" project; specifically, "Search For A Friend" lesson. It has me learning how Objects work and how to look within them.</p>
  
  <p>The demonstrated code is as follows:</p>
  
  <pre><code>var friends = {};
  friends.bill = {
    firstName: "Bill",
    lastName: "Gates",
    number: "(206) 555-5555",
    address: ['One Microsoft Way','Redmond','WA','98052']
  };
  friends.steve = {
    firstName: "Steve",
    lastName: "Jobs",
    number: "(408) 555-5555",
    address: ['1 Infinite Loop','Cupertino','CA','95014']
  };
  
  var list = function(obj) {
    for(var prop in obj) {
      console.log(prop);
    }
  };
  
  var search = function(name) {
    for(var prop in friends) {
      if(friends[prop].firstName === name) {
        console.log(friends[prop]);
        return friends[prop];
      }
    }
  };
  
  list(friends);
  search("Steve");
  </code></pre>
  
  <p>So I understand that <code>friends</code> is an object and <code>bill</code> and <code>steve</code> are objects within <code>friends</code>. What I don't understand is how <code>list</code> and <code>search</code> functions look inside <code>friends</code>. I see that it uses a <code>for/in</code> loop... but after learning loops, I see no conditions and I see no iteration mechanism. I have no concept on how this <code>for/in</code> is actually working. Maybe if someone could provide an alternate of equivalent syntax; perhaps, even, if someone can explain in colloquial English <strong>why/how</strong> <code>for/in</code> works?</p>
  
  <p>Thank you!</p>
  
  <p>NOTE: Tagging as Language-Agnostic, because it's a higher-level programming/conceptual question, even if the syntax here is JavaScript.</p>