Contact List


#1


https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/6?curriculum_id=506324b3a7dffd00020bf661#


Oops, try again. Did you create a function called list?Oops, try again. Did you create a function called list?


var friends=
{
    bill: 
    {
        firstName: "Bill",
        lastName: "Gates",
        number:"(206) 555-5555",
        address: ['One Microsoft Way','Redmond','WA','98052']
    },
    steve: 
    {
        firstName: "Steve",
        lastName: "Jobs",
        number:"(206) 555-5556",
        address: ['two apply way','Redmond','WA','98052']
    },
}
var list = function (friends)
{
    for(var i= 0; i<8;i++)
    {
        console.log(key)
    }
}


#2

here

var list = function (friends)

Change the parameter name.friends is an object so don't take the same name as parameter.
and here

for(var i= 0; i<8;i++)
    {
        console.log(key)
    }

where did you get key ?
Instruction:

In the body of the function, write a for/in loop.

for...in syntax:

for (key in object) { 
  //code block to be executed
}

you have to loop through the object.here you can take any name in the place of key and in the place of the object you have to write the name of the object.now you can print the keys.

also remember to call the function after closing the function.


#3

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