Stage 7 of Contact List :: What exactly is going on, here?


Rant for the Devs/Mods
For starts, I'm just going to start with a complaint.
This might be freeware, but, it has a payable side. So far; the freeware has more often pushed me away from paying than it has attracted me to it.

This section was really the tip of the iceberg, however. It feels like they're just dropping stuff on us without taking the time to explain, this sections Hint's weren't hints at all, they were straight up answers; you don't learn when you're just given the answer...
End Rant
So the problem at hand is this; without what I feel would be proper education I have NO IDEA what is going on here. I mean, yeah creating an object was easy for me to wrap my head around. However, when it came down to that actual part that made this whole thing tick, the search function and the list function, I really got lost.

I'm getting different errors every time I try to rewrite the code that I have for them; and again, I feel the instructions are really weak in describing what is going on, why, and how. I've had bumps in the road so far because of small things, but I was able to work at it and overcome them and understand what went wrong and how I messed it up. This thing is a mountain though, and it's really frustrating.

Alas, here's my code... (This is the code I took word for word from the answer in the hint section, the only subbing I did was where it said "key" I used the key from my object(s).)

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: 5872234648,
        address: ["Who the f--- knows" , "Somewhere I'm not", "DK", "95457"]},
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: 4478584946,
        address: [ "Okay, California" ,"That could be wrong, honestly." , "Too soon?" , "69777" ] },
    //Field omitted
    kerrigan: {
        firstName: "Kerrigan",
        lastName: "Queen of the Zerg",
        number: 6666661337,
        address: ["Somewhere in the galactosphere" , "Killing nubs no doubt" , "Probs not the Milkyway, dough" , "17D-K94-XMDB" ] },
var list = function (friends) {
        for (var firstName in friends) { console.log (firstName) } } ;
var search = function (name) {
    for (var firstName in friends) {
        if (friends[firstName].firstName === name) {
            console.log (friends[firstName]);
            return friends[firstName]}
        else {
            console.log ("Sorry, let's try another name.") }


i think you have to return false if there is no match found
Also you might wanna move this statement

out of the for loop(which mean remove the else block) because each time the current object in friends does not have a firstName that matches the input argument, that statement will be executed(printed) and that is not what you want to have.


I'm not sure if you thought this would indeed do something, but, it did nothing.
Part of the issue is that the instructions here are truly garbage, it just threw something at us and, as many times as I repeat this unit, it has no real process of explanation for understanding.
I appreciate your efforts in trying to help, though.


Try to change all friends name in friends object.
like that Steve: {}


You are missing a ";" at the end of the line "return friends[firstName]" needs to be "return friends[firstName];"
And same with your console.log line in your else statement.