Question 6


#1

I don't know why this is not working for me, could someone please tell me whats wrong and explain. Thank you in advance.

var friends = new Object;
friends.bill = new Object();
friends.bill.firstName = "Bill"
friends.bill.lastName = "Gates"
friends.bill.address =['Mushin', 'to', 'mohits']
friends.bill.number = "692458945"
friends.steve = new Object();
friends.steve.firstName = "Steve"
friends.steve.lastName = "Gates"
friends.steve.number = "3578575501"
friends.steve.address = ['Silicon', 'Valley']
var list = function(friends){
for (var bill in object){
console.log(bill);
}
};


#2

@perezwillz,

In your list function definition you have 1 parameter friends
This friends parameter is used as a so-called local Variable....

Thus in your FOR-IN loop you should be using this variable friends instead of your object


#3

@perezwillz,

+++ friends list and search and for-in explained.
Look here for an explanation
object
function
for-in-loop
list-function
search-function
http://www.codecademy.com/forum_questions/545275fd8c1ccc8e3e000a23#comment-5457b12c9c4e9d87cb00003f