Why does list function return lowercase?


#1


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

var friends = new Object();
friends.bill = {
firstName: "Bill",
lastName: "Miller",
number: "246-468-8642",
address: ['4 Silver Lane', 'Austin', 'TX', '02468']};

friends.steve = {
firstName: "Steve",
lastName: "Knudsen",
number: "135-357-9753",
address: ['3 Bronze Circle', 'Tucson', 'AZ', '01357']};

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

var search = function(name){
for(var i in friends){
if(friends[i].firstName === "Bill"){
console.log(friends[i]);
return friends[i];}}};

list();

When I call the list function, the names Bill and Steve print in all lowercase in the console. Why is that?


Replace this line with your code.


#2

Consider the make up of the object, friends...

var friends = {
    bill: {},
    steve: {}
};

The keys are not the firstName properties found in each object. They are ordinary variable names.

for (var key in friends) {
    console.log(key);
};
// bill
// steve