Logging wrong address?



Why does my code return ["234 E Ave.","Rootmont","MI","87345"]? It logs "Bill" and "Steve" as it should, but then adds that address.

var friends = new Object();
friends.bill = new Object();
friends.steve = new Object();
friends.bill.firstName= "Bill";
friends.bill.lastName= "Wilick";
friends.bill.number= "(222) 222-2222";
friends.bill.address= ['214 W Ave.', 'Richmont', 'WA', '12345']
friends.steve.firstName= "Steve";
friends.steve.lastName= "Wilock";
friends.steve.number= "(232) 222-2232";
friends.steve.address= ['234 E Ave.', 'Rootmont', 'MI', '87345']

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


key is meant to be a word that you change to what you used in your code. so for mine the text says var friend in friends. I use the other version for making objects so this is really confusing for me but I think this should help.


Thanks. But why does my code still log Steve's address: ['234 E Ave.', 'Rootmont', 'MI', '87345']


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