6. list them all (bugs that need fixing)


#1


var friends = {
    bill: {
    firstName:"Bill" ,
    lastName:"Gates" ,
    number:"(206) 555-5555",
    address: ['One Microsoft Way','Redmond','WA','98052']
    },
    steve: {
    firstName:"Steve" ,
    lastName:"Bertin" ,
    number:"(206) 777-7777",
    address: ['Two Intel Road','Salt Lake','UT','84056']
    }
};
var friends =function(list) {
    for (var key in friends){
    console.log(key);}
};

debug please.


#2

The question says "The first function we'll create will be called list".

Here you have created a function called friends. Instead put friends inside the functions parenthesis.

The rest of the code is great though. Let me know if that solved it and/or if you need further explanation.


#3

The error at the bottom says:
Oops, try again. Did you create a function called list?


#4

Could you please copy and paste your new code?


#5

var friends = {
bill: {
firstName:"Bill" ,
lastName:"Gates" ,
number:"(206) 555-5555",
address: ['One Microsoft Way','Redmond','WA','98052']
},
steve: {
firstName:"Steve" ,
lastName:"Bertin" ,
number:"(206) 777-7777",
address: ['Two Intel Road','Salt Lake','UT','84056']
}
};
var friends =function(friends) {
for (var key in friends){
console.log(key);}
};


#6

Just like I said above in your code you have created a function called friends, you are not meant to do this.
Like the error code says, did you create a function called list?

Hint - var list = function(friends).


#7

I tried changing the name to list, but it still gave me the same error.
var list = {
bill: {
firstName:"Bill" ,
lastName:"Gates" ,
number:"(206) 555-5555",
address: ['One Microsoft Way','Redmond','WA','98052']
},
steve: {
firstName:"Steve" ,
lastName:"Bertin" ,
number:"(206) 777-7777",
address: ['Two Intel Road','Salt Lake','UT','84056']
}
};
var friends =function(list) {
for (var key in friends){
console.log(key);}
};


#8

Thank you! You've been a great help!


#9

But how about the next lesson?
Here's my code:
var friends = {
bill: {
firstName:"Bill" ,
lastName:"Gates" ,
number:"(206) 555-5555",
address: ['One Microsoft Way','Redmond','WA','98052']
},
steve: {
firstName:"Steve" ,
lastName:"Bertin" ,
number:"(206) 777-7777",
address: ['Two Intel Road','Salt Lake','UT','84056']
}
};
var search = function (friends) {
for (var Name in object){
console.log(key);}
};


#10

I don't think you are reading the instructions properly.

Firstly it says "The second function we'll add will be called search". You have just changed the name of your first function. Please read it thoroughly and give it a proper try.


#11

Oh yeah. Thank you! I'll try that.


#12

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