7. Search for a friend


#1

var search = function (name) {
for (var peeps in friends) {
if(friends[peeps].firstName === name) {
console.log(friends[peeps]);
return friends[peeps];

For the function parameter, is it 'name' because the search is more specific? As in I am searching 'friends' -> 'name' ?

If I replace 'name' with 'friends' it will only log the first names instead of the friend's contact information.


#2

@luckydingleberry,

Look here for an explanation
object
function
for-in-loop
list-function
search-function
http://www.codecademy.com/forum_questions/545275fd8c1ccc8e3e000a23#comment-5457b12c9c4e9d87cb00003f


#3

Wow! Very well detailed explanation. Thank you so much for this link.