Contact list 5/6 List em all auto print


Code shown as correct, however, it auto print without me call the list. When I call the list, it adds up another pair of values

var friends = {
    bill: {
        firstName: 'Bill',
        lastName: 'gates',
        number: '121212',
        address: ['One Microsoft Way', 'WA', 12123]
    steve: {
        firstName: 'Steve',
        lastName: 'Jobs',
        number: '41422122',
        address: ['Apple Highway', 'CA', 41423]

var friends2 = {
    a: "absbs",
    b: "12wefa"

var list = function(object) {
    for (var key in object){



You didn't define the variable object. The only object defined is friends, right?


hm.. not exactly. I have 2 objects to test this problem, friends and
Are you trying to say if I define the object by calling list(friends), it
will only show one set of value instead of 2 sets?


What I am saying is that the exercise before this requires you to create an object of two friends (bill and steve), which you have done. While this exercise requires you to create a list function that takes in a single argument, friends, your argument is object which isn't defined.

That said, there is no need for an object friends2.

[If you want to use the two friends, then they should be your arguments...]


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