Hi! It's another person who'd like some help with the Contact List


#1




https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/7?curriculum_id=506324b3a7dffd00020bf661#


The only error message I'm getting here is that "It looks like your search function doesn't return contact information for Steve." I don't quite understand the for/in loop, so maybe I'm just making some rookie mistake. Can anybody explain what I've screwed up to me?

var search = function(name) {
    for (var number in friends) {
        if (friends[number].firstname === name) {
            console.log(number)
            return number;
        }
    }
};


#2

It looks like you'd want to return that friends object in the array:

return friends[number];

If we return number all we get is the index the for loop is on.


#3

@bfoot

Have a close look at

firstname

AND what @levibarker wrote


#4

Thank you very much!