Finding properties in objects (profile look up hints)

I’m trying to accomplish the profile lookup challenge by working out bits of code to understand the problem bit by bit. I’m stumped by trying to evaluate properties within objects. Currently I have a function that looks like this:

function lookUpProfile(prop) {
  for (i = 0; i < contacts.length; i++) {
    if (contacts[i].hasOwnProperty(prop)) {
      console.log('has property');
    } else {
      console.log('has no property');
    }
}

Right now, this function does nothing when called. I’m unsure why. I followed similar syntax when looking for names with success.

function lookUpProfile(name) {
  for (i = 0; i < contacts.length; i++) {
    if (name == contacts[i]['firstName']) {
      console.log('contact');
    }
}

I can’t figure out why one line of code evaluates true and the other doesn’t evaluate at all.

It’s amazing how easily the simplest things get overlooked.