Contact list {functin list not getting created}


#1

Oops, try again. Did you create a function called list?
even when i have created the list function it shows this error


var friends={
  bill:{
     firstName:"Bill",
     lastName:"joh",
     number:13455667,
     address:['Blore']
  },
  steve:{
     firstName:"Steve",
     lastName:"den",
     number:12344567,
     address:['Chennai']
  }
};
var list = function (friends) {
    for (var key in friends) {
        console.log(friends[firstName]);
    }
};

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


#2

Back to instruction...

In the loop, use console.log to print out the key. (For example, if you only have bill and steve as entries, list should just print out "bill" and "steve".)

Your code..

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

You have to print key (that you're using for iteration)?
Your key here is key ?


#3

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