6/8 List 'em all!


#1

This is my code, the system told i pass this topic already,
but i wondering the window print out not only the names but also the line" ["tayouan","rocker","road"] "
@@|| WHY!? plz tell me~~ thx~

var friends = new Object();

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

friends.bill.firstName="Bill";
friends.bill.lastName="Watson";
friends.bill.number=0933-971-255;
friends.bill.address=['taipei','Nankang','studio'];

friends.steve.firstName="Steve";
friends.steve.lastName="Watson";
friends.steve.number=0910-155148;
friends.steve.address=["tayouan","rocker","road"];

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

    console.log(i);
}

}


#2

I'm having the exact same issue. I noticed that the console is logging the object names bill and steve, and not the actual value of "Bill" or "Steve". They both display lowercase like the object name. It will display the object name even if I change the value of the name to something completely different.


#3

Try this out.

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