Info displayed 2 times


#1


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


{ firstName: 'Bill',
lastName: 'Gates',
number: '(206) 555-5555',
address: [ 'One Microsoft Way', 'Redmond', 'WA', '98052' ] }
{ firstName: 'Steve',
lastName: 'Jobs',
number: '(206) 555-5555',
address: [ 'One Microsoft Way', 'Redmond', 'WA', '98052' ] }
{ firstName: 'Bill',
lastName: 'Gates',
number: '(206) 555-5555',
address: [ 'One Microsoft Way', 'Redmond', 'WA', '98052' ] }
{ firstName: 'Steve',
lastName: 'Jobs',
number: '(206) 555-5555',
address: [ 'One Microsoft Way', 'Redmond', 'WA', '98052' ] }


var friends = new Object();
friends.bill = new Object();
friends.steve = new Object();

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-5555",
       address: ["One Microsoft Way","Redmond","WA","98052"]
    }
       
};

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


#2

Check your for loop. It may be repeating instead of just looping through your friends.


#3

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