Using period to access object's property but undefined
<p>I am doing the codecademy's javascript tutorial and encountering the problem as following:</p>

<pre>
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){ 
        console.log(prop);
        console.log(friends.prop);//friends[prop] will print out 

  }


};
list(friends);
search("Steve");
</pre>

<p>the console.log(friends.prop) will print out undefined but if I changed it to</p>

<p>friends[prop],  it will print out the bill and steve object information.</p>

<p>I see the w3c tutorial say that two of the access method is right and I cannot figure out</p>

<p>what is the problem?</p>

<p>Thx in advance. </p>
