I can list bill and steve but output is printing objects to console


#1


The keys in the friends object are printing out along with object.

Output:

bill
steve
{"firstName":"Steve","lastName":"jobs","phone": "blah blah","address":["blah","blah","blah"]}


var friends= new Object();

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

friends.bill={
  
  firstName: "Bill",
  lastName:  "Gates",
   number: 7382232331,
  address: [4/35,"Kandukur","Ongole District"]
};

friends.steve={
    
    firstName:"Steve",
    lastName:"jobs",
    phone: 886899994,
    address :["7/33","Bnagalore","Karnataka"]
    
};

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

}


#2

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