Profile Lookup Help Requested

First I apologize for asking again, I know this has been answered many times before; I already browsed through the previous answers, but still, stubbornly, I want to know exactly how to get from where I am at, to where I need to be, since I got to this point today without any cutting/pasting or flat-out copying of code. I just keep circling back to previous exercises I have already done, granted, with lots of help from y’all.

So my pieces for “No such contact” and “No such property” work on their own, separately, but not together.

Here’s what I have for the no contact/no prop pieces:

I don’t need to spoiler this next one, because it’s WRONG…

I feel like this whole entire exercise is falling apart for me upon a fundamental lack of understanding the “return” statement. The fact that my first two parts run until they get to a “return” and then just stop completely, why is this happening? And how do I make it “return” the contents of the property not the name of the property? (It’s not even saying the name anyway.) When did we learn this? Where was I?

So it’s a lot easier to help when you give us your whole code in context, and it’s much nicer if you can give us formatted text instead of an image. ( If you need help formatting your code in Gitter, look here. )

I think this is what you’re running into in your second screenshot:
On line 37 you have return prop;. What is prop? What is its value?

Sorry about that, the only reason I didn’t put it all is because it’s kinda long, but here’s the context:

//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
  
  for (var i = 0; i < 5; i++) {
    if (lookUpProfile.firstName == firstName && lookUpProfile.hasOwnProperty(prop) == prop) {
      
      return prop;
    }
      
  }

What is prop? What is its value?

Well, assuming the firstName matches one of the four in our contacts database, then it depends which property was requested by the query: firstName, lastName, number, or likes. The value will be whatever is assigned to that property; it could be a string, a number, an array, anything. I don’t know how to craft the statement to get it.

Thanks for taking the time to look at this.

I may have caused confusion because I left out some of my code, sorry.

these two pieces work separately but not together:

for (var i = 0; i < 5; i++) {
  if (lookUpProfile.firstName !== firstName) 
    return "No such contact";
}
  
  for (var j = 0; j < 5; j++) {
   if (lookUpProfile.prop !== prop) 
      return "No such property";
 }

What value do you think lookUpProfile.firstName has in it when you are comparing it to the firstName which is passed into the function?

Well, based on the fact that the code I’m showing you here seems to be working to identify when a name doesn’t match, I thought it was going to work the other way around and match the contacts name to the requested name.

Fwiw, I tried contacts.hasOwnProperty(prop) also, but that also did not work.

You know, I do sincerely appreciate your help, but I think I will take some time off from FCC and spend some time over in w3schools (training wheels). I’m glad you suggested that link. Ever since the “Using Objects for Lookups” exercise, I have struggled with each and every exercise here. Everything before that was easy peasy, and then it seems like I took a left when I should have taken a right, and I can’t make anything fit. It’s easy to get help, people are great about that, but I am just having a tough time.

Where is prop being assigned to that?
If you ever see me on Gitter, feel free to hit me up on a PM and we can talk through what is going on.