7. list em all



ERROR: look like your search function doesnt return contact info for Steve.

var friends = new Object();
var list = function(friends){
for (var list in friends){

friends.bill = {
firstName: 'Bill',
lastName: 'Gates',
number: '555-7564948',
address: ['coronado way','87','sanfran']

friends.steve = {
firstName: 'Steve',
lastName: 'Jobs',
number: '888-9837498',
address: ['talegas dr', '34' ,'hochi']
var search = function(name){
for (var search in friends){
if(friends.bill[firstName] === name){
return friends.bill;
if(friends.steve[firstName] === name){
return friends.steve;


first of all you didnt call yout search function with an property.


And your search function is wrong.
What would your search function do if we add some more propertys to your friends object?


how can i add more properties to my friends object?


This would add Gerda

friends.gerda= {
    firstName: 'Gerdal',
    lastName: 'Holmes',
    number: '555-3562782',
    address: ['Example way','1337','Newtown']

But this is not what you should do, it`s only a question of mine.
Hardcoding like you do it in your search function is not good


This has got to be one of the most challenging exercises I've encountered yet. The explanation is not very clear at this point. All that is needed is this:

var list = function(obj) {
for(var prop in obj) {

to list the information in the instructions, but I absolutely do not understand how that bit of code translates to what the instructions are asking.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.