Skip to content

Basic Javascript: Profile Lookup Challenge solution not working #38

Description

@stonecrusher

Lookup Challenge

"Get a hint" on freecodecamp is down (error 500 - internal server error), so I found this github page.

Unfortunately the solution given does not work / is not accepted by fcc, but this does

function lookUpProfile(firstName, prop){
// Only change code below this line
  for (var i=0; i < contacts.length; i++) {
    if (contacts[i].firstName === firstName) {
      if (contacts[i].hasOwnProperty(prop)) {
        return contacts[i][prop];
      }
      else {
        return "No such property";
      }
    }
  }
  return "No such contact";
// Only change code above this line
}

I think .some() is not known to beginners at that point.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions