GOT IT, here's a copy for people struggling. Then you can work backwards with your own code


#1

Continuing the discussion from I'm Sorry. GOT IT ! I really don't get this one. LIST/SEARCH and whatever comes next (if I ever get there):

var friends = new Object();

friends.bill = new Object();
friends.bill.firstName = "Bill";
friends.bill.lastName = "Gates";
friends.bill.number = "(206) 555-5555";
friends.bill.address = ['One Microsoft Way', 'Redmond', 'WA', '98052'];

friends.steve = new Object();
friends.steve.firstName = "Steve";
friends.steve.lastName = "Jobs";
friends.steve.number = "500-500012";
friends.steve.address = ['No.4', 'Sunset on Dream', 'SSC', '101'];

friends.dany = new Object();
friends.dany.firstName = "Dany";
friends.dany.lastName = "Godfrey";
friends.dany.number = "123-144567";
friends.dany.address = [ 'Nature Park Hotsprings', 'Rocketville County', 'RSPV'];

friends.sara = new Object();
friends.sara.firstName = "Sara";
friends.sara.lastName = "Hemmingway";
friends.sara.number = "144-145672";
friends.sara.address = [ 'Idaho', 'Idaho State', '4330'];

friends.tanita = new Object();
friends.tanita.firstName = "Tanita";
friends.tanita.lastName = "Russell";
friends.tanita.number = "300-300900";
friends.tanita.address = [ 'Kindom of Canada', 'Royal Richmond', 'RR123'];

var list = function(friends) {
for(var key in friends) {
console.log(key);
}
};

var search = function(name) {
for( var key in friends) {
if(friends[key].firstName === name) {
console.log(friends[key]);
return friends[key];
}
}
};
list(friends);
search("Steve");

Also, if you have any questions I'm more than happy to help. ^.^