Contact List: 6. List them all - Buggy?!


#1

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

When I type var list = function (friends) list stays blue. I can't pass this lesson.


var friends = {
    carlos: {
        firstName: 'Carlos',
        lastName: 'Valles',
        number: 1,
        address: ['123 Linden St', 'Long Beach', 'CA', '90813']},
    chase: {
        firstName: 'Chase',
        lastName: 'Mirassou',
        number: 2,
        address: ['123 Orange St', 'Long Beach', 'CA', '90815']},
    anthony: {
        firstName: 'Anthony',
        lastName: 'Spencer',
        number: 3,
        address: ['123 Imperial Hwy', 'Norwalk', 'CA', '90210']},
    bill: {
        firstName: 'Bill',
        lastName: 'Gates',
        number: 4,
        address: ['One Microsoft Way', 'Redmond', 'WA', '98052']},
    steve: {
        firstName: 'Steve',
        lastName: 'Jobs',
        number: 5,
        address: ['1 Infinite Way', 'Cupertino', 'CA', '95014']}
};

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


#2

your for loop:

for (var key in object)

object is a general term we use for objects. Which object do you want to loop over? Use the name of this object


#3

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