Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Javascript: Profile Lookup Challenge solution not working #38

Open
stonecrusher opened this issue Feb 4, 2018 · 0 comments
Open

Comments

@stonecrusher
Copy link

stonecrusher commented Feb 4, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant