Search a friend


#1

what's wrong in my code

var recherche = function (pNom) {
for (var prenom in pNom) {
if (pNom[prenom] === amis) {
console.log(pNom[prenom]);
return pNom[prenom];
}
}
}


#2

I don't know French, but from what I can gather:

  1. Your for-in loop should loop over friends (amis?) array as friend(ami?).
  2. You have to check if friend[first name] (ami[prenom]?) equals the argument (pNom)

Hope that helps!