I need help!


it just tells me that my code doesn't return contact information on steve. can someone help me?

var friends = {};
friends.steve = {
    firstName: "steve",
    lastName: "jobs",
    number: "555-555-5551",
    address: ["One infinite loop","Beverly Hills", "CA"]

friends.bill = {
    firstName: "bill",
    lastName: "gates",
    number: "555-555-5552",
    address: ["One Microsoft Way","Redmond","WA"]

friends['chris'] = {};
    friends.chris.lastName= "loughmiller";
    friends.chris.number= "555-555-5551";
    friends.chris.address= ["One north street","wellington","KS"];
friends['rover'] = {};
    friends.rover.firstName= "rover";
    friends.rover.lastName= "marshall";
    friends.rover.number= "555-555-5552";
    friends.rover.address = ["The kennal house","austin","TX"];

friends.kylie = new Object();
friends.kylie.firstName = "kylie";
friends.kylie.lastName = "jones";
friends.kylie.number = "555-555-5551";
friends.kylie.address = ["7834 N blonde St","New york","NY"];

friends.jeff= new Object();
friends.jeff.firstName = "jeff";
friends.jeff.lastName = "bilbe";
friends.jeff.number = "555-555-5552";
friends.jeff.address = ["Dirt road nowhere","St.louis","MO"];

var list = function(friends) {
    for(var ctct in friends){
var search = function (name) {
    for (var sear in friends) {
        if(friends[sear].firstName === name) {
            return friends[sear]


Remember punctuation and grammar mean a lot to JavaScript, I believe the error is coming because it's expecting "Steve" instead of "steve". See if that changes anything.


Also, I noticed there's no call statement for the "search" function, maybe you're not receiving the console statement because the function isn't being called?


Thanks that solved everything! :smile: .one last question why when i call search it shows steve jobs and bill? when i searched chris?


Because friends is an Object, not an array. So giving the object array-like qualities will not yield results in the same way as otherwise. It won't error, but you'll have to call it in a different way.

Basically, it doesn't apply as an object within the friends object, a "nested object" if you will. What it does instead is it becomes an object in an array, which is separate from the object itself. If you wanted to call "chris's" first name then you'd have to do something like:


I hope this makes sense!